Details
Description
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)
logger.setParent(parent);
}
// posible fix
if (i==-1)
// 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.