logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luigi Alice <Luigi.Al...@persis.de>
Subject Log level issue with multiple loggers
Date Wed, 18 Sep 2013 11:11:26 GMT

I want to log to two different files, each file with different log levels.
Firstly, I defined the root logger with Level ERROR which is writing to file number "1".
Then the second logger with special Logger-Name "1292B83C9F81DAB40710C063C441A641.P011Tomcat60001"
should log to file number "2" with Level ALL.
The problem is:
Log-Level entries in file "2" with the level of WARN and above are also logged to file "1".
But there must only be ERROR-Messages in file "1".
I don't want to use additivity="false" because file 1 is the global logger (it logs all activities)
and file 2 is only a user-specific logger.
I use Apache Log4j 2 Beta 9

Here is the configuration:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="debug">
        <RollingFile name="RollingFile" fileName="${ctx:log.dir}/global.log"
%X{location}: %m%n</pattern>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="10 MB"/>
            <DefaultRolloverStrategy max="50"/>
       <RollingFile name="1292B83C9F81DAB40710C063C441A641.P011Tomcat60001" fileName="${ctx:log.dir}/1292B83C9F81DAB40710C063C441A641.P011Tomcat60001/user.log"
%X{location}: %m%n</pattern>
                <SizeBasedTriggeringPolicy size="10 MB"/>
        <root level="ERROR">
            <AppenderRef ref="RollingFile"/>
        <logger name="1292B83C9F81DAB40710C063C441A641.P011Tomcat60001" level="ALL">
            <AppenderRef ref="1292B83C9F81DAB40710C063C441A641.P011Tomcat60001"/>


Mr.  L. Alice
Software developer



Persis GmbH
Erchenstraße 12
89522 Heidenheim
Tel.: +49 7321 9884-0
Fax: +49 7321 9884-98
E-Mail: luigi.alice@persis.de<mailto:luigi.alice@persis.de>
Web:    www.persis.de<http://www.persis.de/>

Sitz der Gesellschaft: 89522 Heidenheim
Registergericht: Ulm
Handelsregister Nr.: HRB 660674
Geschäftsführer: Rainer Kolb, Michael Barth

  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message