logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leos Literak <Leos.Lite...@12snap.com>
Subject Re: AsyncAppender
Date Wed, 17 Jan 2001 14:34:05 GMT
Hello Ceki,

I have found one unexpected behaviour of
asynchronous appender. When I use this config file,
LOG_DAEMON will contain content of LOG_NOTIF too,
though I set additivity to false. If I remove
async, it works, as it should.


<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE configuration SYSTEM "log4j.dtd">

<configuration>

         <appender name="ASYNC_DAEMON"
class="org.apache.log4j.AsyncAppender">
            <appender-ref ref="LOG_DAEMON" />
            <appender-ref ref="LOG_NOTIF" />
         </appender>

        <appender name="LOG_DAEMON"
class="org.apache.log4j.RollingFileAppender">
           <param name="File" value="logs/daemon.log" />
           <param name="MaxFileSize" value="5MB" />
           <param name="MaxBackupIndex" value="1000" />
           <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern"
                    value="%d | %15.15c{1} | %m%n"/>
           </layout>
        </appender>
 
        <appender name="LOG_NOTIF"
class="org.apache.log4j.RollingFileAppender">
           <param name="File" value="logs/notifications.log" />
           <param name="MaxFileSize" value="5MB" />
           <param name="MaxBackupIndex" value="1000" />
           <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern"
                    value="%m\n"/>
           </layout>
        </appender>
 
        <category name="myclass.status" additivity="false">
          <priority value="info" />
           <appender-ref ref="LOG_NOTIF" />
        </category>
 
        <root>
           <priority value ="info" />
           <appender-ref ref="ASYNC_DAEMON" />
        </root>
 
</configuration> 


But when I create two AsyncAppenders and separate both logs to them,
it works fine again.

         <appender name="ASYNC_DAEMON"
class="org.apache.log4j.AsyncAppender">
            <appender-ref ref="LOG_DAEMON" />
         </appender>
         <appender name="ASYNC_NOTIF"
class="org.apache.log4j.AsyncAppender">
            <appender-ref ref="LOG_NOTIF" />
         </appender>

Is this behaviour correct? Now it uses one additional thread, doesn't
it?
Thank you.

	LL

-- 
-----------------------------------------------------
Leos Literak
Software Engineer

12snap s.r.o.
Pstrossova 24
110 00 Praha 1
Czech Republic

mobile:         +420-605-849-087
phone:  +420-2-21-970-239
fax:    +420-2-21-970-241
e-mail: leos.literak@12snap.com

Mime
View raw message