From: Mike S. <m...@pe...> - 2006-03-03 19:39:12
|
On Fri, 3 Mar 2006, Martin J. Evans wrote: > I was surprised to see every log file named in my log4.conf file > under "appender.XX.filename" had been created and was open. That's exactly how Log::Log4perl's file appender works. It opens all log files at init(), not when you obtain a logger. I wonder how it is possible to run out of file descriptors with only three open files per process, though. Are you running hundreds of daemons simultaneously? If opening the log files at startup imposes a problem, you could write your own log file appender that opens files at log() instead. If you look at the implementation of Log::Log4perl::Appender::File you'll see that it's actually quite simple. -- Mike Mike Schilli m...@pe... > This may > be my misunderstanding of the way log4perl works but it is > undesirable for me so I wondered if either a) these log files should > not be open or b) if my conf file was wrong. Given: > > log4perl.logger.Server = WARN > log4perl.logger.Server.Markets.Close = DEBUG, A1 > log4perl.appender.A1=Log::Dispatch::File > log4perl.appender.A1.filename=/tmp/markets_close.log > log4perl.appender.A1.mode=append > log4perl.appender.A1.layout=Log::Log4perl::Layout::PatternLayout > log4perl.appender.A1.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n > log4perl.appender.A1.Threshold=INFO > > log4perl.logger.Server.CGI.Post = DEBUG, A3 > log4perl.appender.A3=Log::Dispatch::File > log4perl.appender.A3.filename=/tmp/cgi_post.log > log4perl.appender.A3.mode=append > log4perl.appender.A3.layout=Log::Log4perl::Layout::PatternLayout > log4perl.appender.A3.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n > > log4perl.logger.Server.Queued = DEBUG, A5 > log4perl.appender.A5=Log::Dispatch::File > log4perl.appender.A5.filename=/tmp/queued.log > log4perl.appender.A5.mode=append > log4perl.appender.A5.layout=Log::Log4perl::Layout::PatternLayout > log4perl.appender.A5.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n > > why are A1.filename, A3.filename and A5.filename all created and open when I > run the above Perl. I would have expected A5.filename to be opened when I did > get_logger("Server::Queued") but no files other than log4.conf to be open when > all I've done is init_and_watch. > > Any ideas. > > Martin > -- > Martin J. Evans > Easysoft Ltd, UK > http://www.easysoft.com > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |