Details
-
Bug
-
Resolution: Fixed
-
None
-
1.5.x
-
None
-
Operating System: Mac OS X 10.3
Platform: Macintosh
-
blocker
-
P1
-
131
Description
Using log4j-over-slf4j and jdk logging reports the wrong Source Class Name and Source Class Method in the final log output.
Example code to exercise this:
package bug.test;
public class LoggingTestBean
{
public static final org.slf4j.Logger slf4jLogger = org.slf4j.LoggerFactory.getLogger("slf4jLogger");
public static final java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger("julLogger");
public static final org.apache.commons.logging.Log commonsLogger = org.apache.commons.logging.LogFactory.getLog("commonsLogger");
public static final org.apache.log4j.Logger l4jLogger = org.apache.log4j.Logger.getLogger("l4jLogger");
public void slf4jLogMessage(String message)
{ slf4jLogger.info(message); }public void julLogMessage(String message)
{ julLogger.info(message); }public void commonsLogMessage(String message)
{ commonsLogger.info(message); }public void l4jLogMessage(String message)
{ l4jLogger.info(message); } public static final void main(String[] args)
{
try
catch (Exception ex)
{ ex.printStackTrace(); } }
}
The output from running this is:
(zampetti@C0A805BC)->./test.sh hello
Mar 26, 2009 5:33:27 PM bug.test.LoggingTestBean slf4jLogMessage
INFO: hello
Mar 26, 2009 5:33:28 PM bug.test.LoggingTestBean julLogMessage
INFO: hello
Mar 26, 2009 5:33:28 PM bug.test.LoggingTestBean commonsLogMessage
INFO: hello
Mar 26, 2009 5:33:28 PM org.apache.log4j.Category info
INFO: hello
And test.sh is:
#!/bin/sh
CP="./target/classes"
CP="${CP}:${HOME}/java/slf4j-1.5.6/slf4j-api-1.5.6.jar"
CP="${CP}:${HOME}/java/slf4j-1.5.6/slf4j-jdk14-1.5.6.jar"
CP="${CP}:${HOME}/java/slf4j-1.5.6/jcl-over-slf4j-1.5.6.jar"
CP="${CP}:${HOME}/java/slf4j-1.5.6/log4j-over-slf4j-1.5.6.jar"
exec java -cp "${CP}" bug.test.LoggingTestBean ${*}