From: Roger D. <rog...@gl...> - 2006-07-03 16:01:20
|
At 16/06/2006 17:31:45, Mike Schilli <m...@pe...> wrote: >On Thu, 15 Jun 2006, Roger Day wrote: > >> My logging situation is complex - the pseudo-code looks like this: >> >> <initialise main log> >> log to main log >> : : >> for 1 to n of builds >> log to main log >> : : >> <swap for local log for building component> >> log to local log >> : : >> <swap to main log> >> log to main log >> : : >> >> so I'm swapping appenders every so often, which is why I didn't use >> Log::Log4perl->init. In fact, I destroy the previous local-log appender. > >It's not exactly a common thing to do in Log4perl, but you can certainly >do it :). I'd rather use a buffer appender for this purpose, though, >and I would just check the buffer every so often and write its content >to the appropriate file. This way, you put the logic out of Log4perl >and into your application, where it probably belongs in the first place. >But YMMV, of course. OK, I agree with the buffer appender but swapping the appenders seems to be working quite nicely now and I don't really want to re-work this SOB piece of code as it's up for replace RSN :-) >> Or maybe I could us Log::Log4perl->init every time? > >init() is usually only called once at the start of the program. Just checking. Cool software BTW. Cheers Roger |