I finally found the time to implement the solution for switching logfiles at
run-time
(see my posting "Re: Appender::File and Layout question" from March 6), but now
I am facing a new problem: Perl (ActivePerl 5.8 on Windows) crashes when I try
to
switch the file.
Here is the example code:
I'm creating loggers with easy_init (deliberately using no
initialization file), and found that they are always created in
'clobber' mode. After studying the code, I found I could change the mode
of a specific logger to 'clobber' using
Log::Log4perl->appender_by_name('app002')->{mode}='append';
There's a gotcha: If you're using "STDOUT" as the 'file' parameter,
easy_init() creates a Screen appender, not a File appender -- hence you
can't call file_switch() on it.
I'd recommend using a standard l4p init file (or string) to define
exactly what kind of appender you want (File in this case).
On Mon, 23 Mar 2009, Ronald Fischer wrote:
> I'm creating loggers with easy_init (deliberately using no
> initialization file), and found that they are always created in
> 'clobber' mode.
If you want "append", use ">>file":
"The "file" parameter takes file names preceded by ">"
(overwrite) and