[logback-dev] [JIRA] Updated: (LBCLASSIC-305) Logger does not implement LocationAwareLogger correctly with Wrapper class

Steve Cohen (JIRA) noreply-jira at qos.ch
Mon Nov 7 15:55:12 CET 2011


     [ http://jira.qos.ch/browse/LBCLASSIC-305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Cohen updated LBCLASSIC-305:
----------------------------------

    Attachment: logback-bug-2.zip

In this version of the project (logback-bug-2.zip) it's a bit easier to see what's going on.  This version rewrites LogHelper so that trace(...) delegates to Logger.trace() whereas all the other levels delegate, as before, to LocationAwareLogger.log().  It shows that the former does find correct (but, of course, non-location-aware) stack traces to work with but the latter does not find correct stack traces.

Output:

2011-11-07 08:28:23,230 DEBUG [main] ?#?:?
 - Constructor of A
2011-11-07 08:29:30,554 TRACE [main] Caller+0	 at org.javactivity.LogHelper.trace(LogHelper.java:51)
 - A()
2011-11-07 08:34:42,981 DEBUG [main] Caller+0	 at org.javactivity.A.<init>(A.java:10)
 - Constructor of B
2011-11-07 08:35:16,844 TRACE [main] Caller+0	 at org.javactivity.LogHelper.trace(LogHelper.java:51)
 - B()

> Logger does not implement LocationAwareLogger correctly with Wrapper class 
> ---------------------------------------------------------------------------
>
>                 Key: LBCLASSIC-305
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-305
>             Project: logback-classic
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Steve Cohen
>            Assignee: Logback dev list
>         Attachments: logback-bug-2.zip, logback-bug.zip
>
>
> As shown in the attached project, we are logging using Logback classic through a wrapper class (LogHelper), with formatting specified by the %caller format specifier.  Instead of showing the desired actual caller of the LogHelper.debug() method, the output shows as the caller, the caller of the caller of the logHelper.
> I'm expecting: 
> 2011-11-06 18:49:59,650 DEBUG [main] Caller+0	 at org.javactivity.A.<init>(A.java:8)
>  - Constructor of A
> 2011-11-06 18:49:59,654 DEBUG [main] Caller+0	 at org.javactivity.B.<init>(B.java:7)
>  - Constructor of B
> Instead I get:
> 2011-11-06 18:49:59,650 DEBUG [main] ?#?:?
>  - Constructor of A
> 2011-11-06 18:49:59,654 DEBUG [main] Caller+0	 at org.javactivity.A.<init>(A.java:9)
>  - Constructor of B

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list