[slf4j-user] Logging class and line number is not correct

Ceki Gülcü listid at qos.ch
Tue Dec 13 11:25:25 CET 2005


At 09:30 AM 12/13/2005, Allan Lauridsen wrote:
>Hi all,
>
>I have the following set up:
>
>J2EE app server: WebSphere 5.1 (running with local test environment)
>Classloader mode: PARENT_LAST
>WAR classloader policy: APPLICATION
>
>I am using the NLOG (1.2.19) implmentation and I am using 
>jcl104-over-slf4j.jar from the RC3 release. I have Struts, the Spring 
>Framework and other libs in my classpath... but no commons-logging.jar in 
>there!
>
>I get the following in my log file (which is currently the console):
>
>[12-12-05 12:54:22:044 CET] 29d235d4 SystemOut     O DEBUG 
>[Servlet.Engine.Transports : 0] (SLF4JLog.java:97) - Searching: , Filter: 
>(uid=exgall)
>[12-12-05 12:54:22:076 CET] 29d235d4 SystemOut     O DEBUG 
>[Servlet.Engine.Transports : 0] (SLF4JLog.java:97) - Loading groups for 
>user: EXGALL
>
>As you can see the log statements tell me that the logging has occured in 
>SLF4JLog.java:97.. This is surely not the case... it is another class.

Sorry, in my previous message I had missed that you had already specified 
version information.
The problem is easy to explain. While slf4j-log4jX or nlog4j do the correct 
thing (TM) to preserve line information, call going over jcl104-over-slf4j 
go through two abstraction, jcl and slf4j. One could draw it as:

my application -> JCL API -> jcl104-over-slf4j -> SLF4J API -> NLOG4J

while the SLF4J -> NLOG4J step preserves caller information, the 
jcl104-over-slf4j -> SLF4J API step does not. I can't think of any easy 
solution at this moment in time. Would you care to file a bug report under 
the title "jcl104-over-slf4j does not preserve caller information" please?

>Does any of you have a good hint?
>
>BTW all my log statements are also logged twice...

That's probably due to your log4j config file independent of SLF4J.

>Best Reagards
>Allan Lauridsen

-- 
Ceki Gülcü

   The complete log4j manual: http://www.qos.ch/log4j/





More information about the slf4j-user mailing list