From: Chris A. <ch...@nu...> - 2005-09-09 17:30:18
|
Mike Schilli wrote: >On Fri, 9 Sep 2005, Chris Anderson wrote: > > > >>In an application where I have multiple children each needing to log to >>their own file, I've noticed using the get_logger() or init to changes >>the configuration for all the children and the parent as well. So >>effectively, when multiple processes use the same instance through >>get_logger() they all just combine in the same file. I didn't see >>anything in the documentation regarding how to handle this, so I was >>hoping someone may be able to shed some light on what I need to do to >>segregate these logging rules. >> >> > >It depends on where you call Log::Log4perl->init(). > >If it's called in each child process, then the filename can be specified >dynamically (using something like the pid): > > http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#02bbc > >If Log::Log4perl->init() gets called in the main process, messages >need to be filtered dynamically, using a custom filter: > > The main process initializes Log4perl, then each child has its own log file to use. > http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#c7fa8 > http://log4perl.sourceforge.net/d/Log/Log4perl/Filter.html > >Let me know if you need more detailed info. > > It looks rather simple to filter based on a level, however with each child dynamically needing a different filename while main initializes I'm not clear on how the filter would need to be setup. >-- Mike > >Mike Schilli >m...@pe... > > |