From: Ronald F. <yn...@mm...> - 2009-03-23 12:10:01
|
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: Log::Log4perl->easy_init( {level => $log_level, file => 'STDOUT', layout => '%.1p %d{HH:mm} %M(%L) %m%n' }, {level => $log_level, file => ">main.log", layout => '%.1p %d{dd.MM. HH:mm:ss (EEE)} %M(%L) %m%n' } {level => $log_level, file => '>dummy.log', layout => '%.1p %d{HH:mm} %M(%L) %m%n', name => 'requestlogger' }, ); ... # Switch 'requestlogger' to new file Log::Log4perl->appender_by_name('requestlogger')->file_switch('request_specific.log'); At this point, Perl complains: "Can't call method "file_switch" on an undefined value" If I change the line so that it uses the default appender name, Log::Log4perl->appender_by_name('app002')->file_switch('request_specific.log'); it works. It seems that easy_init does not use the "name" parameter. Is this a bug in easy_init, or is it supposed to work that way? Ronald -- Ronald Fischer <ro...@em...> + If a packet hits a pocket on a socket on a port, + and the bus is interrupted and the interrupt's not caught, + then the socket packet pocket has an error to report. + (cited after Peter van der Linden) |