[
http://jira.qos.ch/browse/LBCLASSIC-305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12278#action_12278
]
Steve Cohen commented on LBCLASSIC-305:
---------------------------------------
Yes, indeed, it was confusion on my part, thank you. With your suggestion, it
works. In my original implementations I was using the LogHelper class name as
the FQCN, but that wasn't working because I didn't understand the need for
LocationAwareLogger. So somewhere along there, I started passing in the name
of the caller of the logHelper, but this fell afoul of the +1 logic.
If I may make a suggestion:
The explanations in the slf4j javadoc should be improved:
http://slf4j.org/api/index.html?org/slf4j/spi/LocationAwareLogger.html
Currently it says the following
og
void log(Marker marker,
String fqcn,
int level,
String message,
Object[] argArray,
Throwable t)
Printing method with support for location information.
Parameters:
marker -
fqcn - The fully qualified class name of the caller
level -
message -
t -
A couple of points could be clearer as we discussed on the other thread:
1) marker - it may and in this case should be null.
2) fqcn - the comment is confusing. What is the caller? Is it the caller in
the user code who invokes the wrapper (i.e, the one whose location info you
want to see) or it is the wrapper class who invokes LocationAwareLogger.log()?
I now know it's the latter, but it's not hard to see why I became confused.
Anyway, thanks again for a great utility.
> 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
_______________________________________________
logback-dev mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-dev