On Tue, 6 Jul 2010, Foudil wrote: > In order to log to a tmp directory (that we want to remove later), we > create an appender in a script that we add to our project's loggers: > Log::Log4perl->init_and_watch($path_conf."/log.conf", 'HUP');
Hi Foudil, sorry for the long wait. I've noticed that you're using init_and_watch() along with user-defined appenders. Just a heads-up that this can lead to unpredictable situations: Whenever Log4perl/init_and_watch() notices that it needs to reload the configuration file (because it has changed), you'll lose the temporary appender, because the Log4perl configuration will be overwritten. Even if you don't need the appender permanently, it makes sense to have it in the configuration, if only for reasons of clarity. > Log::Log4perl->eradicate_appender($local_appender_name); > # ...but the appender is still alive and keeps filehandles open. So we need > # to close them explicitly. The eradicate_appender() method should take are of the issue in this situation. Only exception: if still have references to the appender anywhere in your application code, the appender destructor won't run and you need to run file_close() manually. Hope that helps! -- Mike Mike Schilli m...@perlmeister.com ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel