On Nov 7, 2007, at 5:30 AM, Begun, Yana wrote:
Hi,
I am looking to the way to use functionality of the both
DayRollingFileAppender and RollingFileAppender for the same logger. Is
it OK to create 2 different appenders with the same file name and
to add
them to the same Logger?
Thanks,
Yana
If the file names refer to the same physical file, then bad things
are likely to happen but log4j will do nothing to stop or warn you.
log4j makes no attempt to detect or synchronize access to a single
file by more than one appender. The scenario arises most frequently
when the same configuration file is loaded into multiple JVM's.
Instead of starting from org.apache.log4j.RollingFileAppender, look
at org.apache.log4j.rolling.RollingFileAppender in the extras
companion which was designed with pluggable triggering policies (when
to roll over) and rolling policies (what to name files). It is
likely that you can achieve your desired behavior by supplying your
own policies and not have to extend the appender. If it isn't
obvious (or even if it is), ask here and we can give advice.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]