[logback-dev] [JIRA] Commented: (LBCLASSIC-102) Suggestion: Change logger name of inner classes.

Syvalta (JIRA) noreply-jira at qos.ch
Mon Dec 14 12:30:33 CET 2009


    [ http://jira.qos.ch/browse/LBCLASSIC-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11442#action_11442 ] 

Syvalta commented on LBCLASSIC-102:
-----------------------------------

Actually, my example of user id was not very well thought, as it would be natural to solve by NDC.

We have a tree (or actually a graph) of objects where every object has an id. When a call chain propagates through the graph, we want to be able to identify the log lines produced by specific instances (say we may have 50 instances of the same class). The id is the same for the whole lifetime of the class.

So what we are conceptually doing is replacing statements like this:

log.info(id + " did something");

with 
<in class ctor> 
log = org.slf4j.LoggerFactory.getLogger(this.getClass().getName() + "." + id)

log.info(did something");

The main goal of this is to avoid doing anything "special" in the actual logging statement, like including the id manually in every logging statement (and there are hundreds or thousands of them).

I'm glad to hear if there is a better way to achieve this.


> Suggestion: Change logger name of inner classes.
> ------------------------------------------------
>
>                 Key: LBCLASSIC-102
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-102
>             Project: logback-classic
>          Issue Type: Improvement
>          Components: appender
>    Affects Versions: 0.9.15
>            Reporter: Joern Huxhorn
>            Assignee: Ceki Gulcu
>             Fix For: 0.9.18
>
>
> At the moment, the logger name of inner classes is OuterClass$InnerClass.
> Because of that, the logging level of OuterClass isn't inherited by InnerClass at the moment.
> If LoggerFactory changed the logger name to OuterClass.InnerClass instead, InnerClass would inherit the logging level of OuterClass which seems intuitively correct.
> I'd suggest to accept both $InnerClass and .InnerClass style in logback configurations for compatibility and usability reasons.

-- 
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