logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: Log level issue with multiple loggers
Date Wed, 18 Sep 2013 11:38:47 GMT
Try setting the log level on the AppenderRef of the root logger:

...
<loggers>
  <root level="trace">
    <AppenderRef ref="RollingFile" level="error"/>
  </root>
...

On Wednesday, September 18, 2013, Luigi Alice wrote:

>  Hello,****
>
> ** **
>
> 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">****
>
>     <properties>****
>
>     </properties>****
>
>     <appenders>         ****
>
>         <RollingFile name="RollingFile"
> fileName="${ctx:log.dir}/global.log"****
>
>
> filePattern="${ctx:log.dir}/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log">**
> **
>
>             <PatternLayout>****
>
>
> <pattern>[%d{HH:mm:ss.SSS}|%X{remoteAddr}:%X{session}(%X{page}%X{includeStack}#%X{taskID})|%X{levelNo}]
> %X{location}: %m%n</pattern>****
>
>             </PatternLayout>****
>
>             <Policies>****
>
>                 <TimeBasedTriggeringPolicy />****
>
>                 <SizeBasedTriggeringPolicy size="10 MB"/>****
>
>             </Policies>****
>
>             <DefaultRolloverStrategy max="50"/>****
>
>         </RollingFile>          ****
>
>        <RollingFile
> name="1292B83C9F81DAB40710C063C441A641.P011Tomcat60001"
> fileName="${ctx:log.dir}/1292B83C9F81DAB40710C063C441A641.P011Tomcat60001/user.log"
> ****
>
>
> filePattern="${ctx:log.dir}/1292B83C9F81DAB40710C063C441A641.P011Tomcat60001/user-%d{yyyy-MM-dd}-%i.log">
> ****
>
>             <PatternLayout>****
>
>
> <pattern>[%d{HH:mm:ss.SSS}|%X{remoteAddr}:%X{session}(%X{page}%X{includeStack}#%X{taskID})|%X{levelNo}]
> %X{location}: %m%n</pattern>****
>
>             </PatternLayout>****
>
>             <Policies>****
>
>                 <SizeBasedTriggeringPolicy size="10 MB"/>****
>
>             </Policies>****
>
>         </RollingFile>      ****
>
>     </appenders>****
>
>     <loggers>     ****
>
>         <root level="ERROR">****
>
>             <AppenderRef ref="RollingFile"/>                       ****
>
>         </root>                  ****
>
>         <logger name="1292B83C9F81DAB40710C063C441A641.P011Tomcat60001"
> level="ALL">     ****
>
>             <AppenderRef
> ref="1292B83C9F81DAB40710C063C441A641.P011Tomcat60001"/>   ****
>
>         </logger>****
>
>     </loggers>****
>
> </configuration>****
>
> ** **
>
> ** **
>
> Regards****
>
> ** **
>
> 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 <javascript:_e({}, 'cvml',
> 'luigi.alice@persis.de');> ****
>
> Web:    www.persis.de****
>
> ______________________________****
>
> ** **
>
> Sitz der Gesellschaft: 89522 Heidenheim
> Registergericht: Ulm
> Handelsregister Nr.: HRB 660674
> Geschäftsführer: Rainer Kolb, Michael Barth****
>
> ** **
>
> ** **
>
> ** **
>

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