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

Syvalta (JIRA) noreply-jira at qos.ch
Mon Dec 14 11:10:34 CET 2009


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

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

We are appending an id to the logger name like this (id could be an user id for example):

log = org.slf4j.LoggerFactory.getLogger(this.getClass().getName() + "." + id);

After upgrading to Logback 0.9.18 we started to see the following exceptions (when the class happens to be an inner class):

java.lang.IllegalArgumentException: For logger [foo.bar] child name [foo.bar.SomeClass$SomeInnerClass passed as parameter, may not include '.' after index8
	at ch.qos.logback.classic.Logger.createChildByName(Logger.java:381)
	at ch.qos.logback.classic.LoggerContext.getLogger(LoggerContext.java:148)
	at ch.qos.logback.classic.LoggerContext.getLogger(LoggerContext.java:48)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:249)



> 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: Logback dev list
>             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