logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 40255] New: - TRACE level does not allow to retrieve the code line number
Date Tue, 15 Aug 2006 15:30:34 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40255>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40255

           Summary: TRACE level does not allow to retrieve the code line
                    number
           Product: Log4j
           Version: 1.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Other
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: fdeangeli@gmail.com


When using Logger.trace(), if the log message is appended to a common ConsoleAppender with
a 
layout conversion pattern including the line number, instead of the line number a question
mark is 
written.

With a log4j.properties equal to:

log4j.rootLogger=ALL, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r %-5p [%t] %37c %3x : %L - %m%n

The following test unit shows the problem:

import junit.framework.TestCase;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

/**
 *
 * @author Francesca De Angeli (fda@ast.cam.ac.uk)
 * @version $Revision$, $Date$
 */
public class LoggerTest extends TestCase {
    Logger logger = null;

    public void setUp() {
        
        PropertyConfigurator.configure("log4j.properties");
        
        logger = Logger.getLogger(LoggerTest.class);
    }

    public void testDummy() {
        logger.debug("Debug msg");
        logger.info("Info msg");
        logger.trace("This will not print out the line number");
    }
}

The output is:

2    DEBUG [main]                  log4jtest.LoggerTest     : 28 - Debug msg
13   INFO  [main]                  log4jtest.LoggerTest     : 29 - Info msg
15   TRACE [main]                  log4jtest.LoggerTest     : ? - This will not print out
the line number

Thanks,
Francesca

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message