On Thu, 6 Nov 2008, Mathieu Longtin wrote: > I have a program that processes a bunch of separate items, logging stuff as > it goes. I would like to be able to capture what gets logged during the > processing on one item, and email the whole thing if the processing failed. > The log messages should go to a file regardless. > > Is there a way to do that in log4perl currently?
You could use one of the Log::Dispatch::Email::* modules on CPAN and set it to 'buffered': http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#How_can_I_configure_Log::Log4perl_to_send_me_email_if_something_happens? When it is time to flush it, retrieve the appender by name and call its flush() method. But I'd probably just use Log4perl to write everything to a log file (use overwrite mode to start a new log file every time) and at the end of the program run a check and send off the logfile via a CPAN module like Mail::DWIM. -- Mike Mike Schilli [EMAIL PROTECTED] ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel