[ 
https://issues.apache.org/jira/browse/LOG4J2-212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladimir Golev closed LOG4J2-212.
---------------------------------


Fixed.
                
> The parent is not set for logger without dot symbol in its name.
> ----------------------------------------------------------------
>
>                 Key: LOG4J2-212
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-212
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0-beta4
>         Environment: used XML configuration.
>            Reporter: Vladimir Golev
>            Assignee: Ralph Goers
>             Fix For: 2.0-beta5
>
>
> Bug in org.apache.logging.log4j.core.config.BaseConfiguration.setParents().
> If logger name doesn't contain dot symbol '.' its parent will not be set. As 
> a result the additivity does not work for such loggers. For example if we 
> define loggers with 'org' or 'java' names, we cant see their events in root. 
> And if logger has no reffered appender its events will be lost.
> Reason:
> Lines 760-761. All logic works only if lastIndexOf('.')>0
> Posible fix:
> if (!name.equals("")) {
>                 final int i = name.lastIndexOf('.');
>                 if (i > 0) {
>                     name = name.substring(0, i);
>                     LoggerConfig parent = getLoggerConfig(name);
>                     if (parent == null) {
>                         parent = root;
>                     }
>                     logger.setParent(parent);
>                 }
>                 // posible fix
>                 if (i==-1) {
>                     logger.setParent(root);
>                 }
>                 // posible fix end
>             }
> Loggers sample config:
>         <logger name="org" level="error" additivity="true"/>
>         <root level="all">
>             <appender-ref ref="STDOUT"/>
>         </root>
> In such configuration all logs from 'org' will be lost.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to