[
https://issues.apache.org/jira/browse/LOG4J2-1529?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sridevi Narra updated LOG4J2-1529:
----------------------------------
Description:
According to Log4j2 Composite configuration documentation
(https://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration)
as given below, logger attributes should be merged.
"Loggers are all aggregated. Logger attributes are individually merged with
duplicates being replaced by those in later configurations. ..."
However, if I have a 2 files that are composed with different Root Logger
levels as given below, only the root level is used. I am not able to override
the root logger level in the second file.
file1.xml:
{code}
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
</Console>
</Appenders>
<Loggers>
<Root level="warn">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>
{code}
file2.xml:
{code}
<Configuration>
<Loggers>
<Root level="info">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>
{code}
Command line arg:
-Dlog4j.configurationFile=file1.xml,file2.xml
Actual: The resulting log level is "warn"
Expected: log level to be "info"
was:
According to Log4j2 Composite configuration documentation
(https://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration)
as given below, logger attributes should be merged.
"Loggers are all aggregated. Logger attributes are individually merged with
duplicates being replaced by those in later configurations. ..."
However, if I have a 2 files that are composed with different Root Logger
levels as given below, only the root level is used. I am not able to override
the root logger level in the second file.
file1.xml:
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
</Console>
</Appenders>
<Loggers>
<Root level="warn">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>
file2.xml:
<Configuration>
<Loggers>
<Root level="info">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>
Command line arg:
-Dlog4j.configurationFile=file1.xml,file2.xml
Actual: The resulting log level is "warn"
Expected: log level to be "info"
> composite configurations do not merge attributes on logger nodes
> ----------------------------------------------------------------
>
> Key: LOG4J2-1529
> URL: https://issues.apache.org/jira/browse/LOG4J2-1529
> Project: Log4j 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.6.2
> Reporter: Sridevi Narra
>
> According to Log4j2 Composite configuration documentation
> (https://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration)
> as given below, logger attributes should be merged.
> "Loggers are all aggregated. Logger attributes are individually merged with
> duplicates being replaced by those in later configurations. ..."
> However, if I have a 2 files that are composed with different Root Logger
> levels as given below, only the root level is used. I am not able to override
> the root logger level in the second file.
> file1.xml:
> {code}
> <Configuration status="WARN">
> <Appenders>
> <Console name="Console" target="SYSTEM_OUT">
> <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
> </Console>
> </Appenders>
> <Loggers>
> <Root level="warn">
> <AppenderRef ref="Console" />
> </Root>
> </Loggers>
> </Configuration>
> {code}
> file2.xml:
> {code}
> <Configuration>
> <Loggers>
> <Root level="info">
> <AppenderRef ref="Console" />
> </Root>
> </Loggers>
> </Configuration>
> {code}
> Command line arg:
> -Dlog4j.configurationFile=file1.xml,file2.xml
> Actual: The resulting log level is "warn"
> Expected: log level to be "info"
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]