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 AW: Log level issue with multiple loggers
Date Wed, 18 Sep 2013 13:19:44 GMT
That's it!

I'm using this:

    <loggers>        
        <root level="ALL">
            <AppenderRef ref="RollingFile" level="INFO" />                       
        </root>                      
        <logger name="1292B83C9F81DAB40710C063C441A641.P011Tomcat60001" level="ALL">
    
            <AppenderRef ref="1292B83C9F81DAB40710C063C441A641.P011Tomcat60001" level="ERROR"
/>   
        </logger>
    </loggers>


By the way: 
What's the difference of setting both level-attributes?



Mit freundlichen Grüßen
 
Herr Dipl.-Inf. L. Alice
Softwareentwicklung

-----Ursprüngliche Nachricht-----
Von: Remko Popma [mailto:remko.popma@gmail.com] 
Gesendet: Mittwoch, 18. September 2013 13:39
An: Log4J Users List
Betreff: Re: Log level issue with multiple loggers

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{inclu
> deStack}#%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.P011Tomca
> t60001/user-%d{yyyy-MM-dd}-%i.log">
> ****
>
>             <PatternLayout>****
>
>
> <pattern>[%d{HH:mm:ss.SSS}|%X{remoteAddr}:%X{session}(%X{page}%X{inclu
> deStack}#%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****
>
> ** **
>
> ** **
>
> ** **
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message