logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Steele" <pste...@maxiscale.com>
Subject RE: Is this a bug or user error?
Date Mon, 18 Aug 2008 14:35:19 GMT
A multi-file-appender would be a great addition. I guess in the meantime
the only solution is to either have all of the applications log to their
own log file or implement a log server. We clearly can't continue to use
the configuration we have now...

-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org] 
Sent: Friday, August 15, 2008 11:27 AM
To: Log4CXX User
Subject: Re: Is this a bug or user error?

On Aug 15, 2008, at 10:59 AM, Peter Steele wrote:

> We use the DailyRollingAppender, defined as follows in our config  
> file:
>    <appender name="FILE"  
> class="org.jboss.logging.appender.DailyRollingFileAppender">
>       <errorHandler  
> class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
>       <param name="File" value="<logfile>"/>
>       <param name="Append" value="true"/>
>       <!-- Rollover at midnight each day -->
>       <param name="DatePattern" value="'.'yyyy-MM-dd"/>
>      <layout class="org.apache.log4j.PatternLayout">
>        <param name="ConversionPattern" value="%d %-5p [%c{1}] %m%n"/>
>      </layout>
>    </appender>
> Several applications log to the same log file using this appender.  
> What's happening is when the rollover occurs at midnight, some  
> processes still log to the original file, which has now been  
> renamed, whereas others log to the main log file as they should. I'm  
> suspecting that this is an error on our part and we should not have  
> multiple processes all log to the same file, although I've heard  
> that others do this. What's the solution?

log4cxx's RFAs mimics log4j's RFAs and having multiple independent  
applications attempt to write to the same location is a common  
misconfiguration problem in the log4j world.  There is no mechanism  
(at least using java.io) to detect the situation, so the best we can  
do is to tell people not to do it.

You are apparently running on non-Windows platform.  What is occurring  
is that one application rolls over renaming the previous log file and  
creates the new log file, when other applications decide that it is  
time to roll over, then fail to create the new log file and continue  
to write to their old handle (which has been renamed since they  
originally opened it).

There has been a long stalled initiative to develop a  
MultiFileAppender for log4j which may handle the situation more  
gracefully (not its main objective), but that development has been  
stalled for a year or so.

View raw message