|
From: Mike S. <m...@pe...> - 2006-10-11 19:51:08
|
On Wed, 11 Oct 2006 mat...@th... wrote:
> I'm using log4perl and, at the end of my script, i want to zip up my
> logfile along with some other information (winxp, activestate
> 5.8.8.817). however, the log4perl logfile is empty in the .zip file.
> the problem is that the buffer isn't flushed by the time i call
> wzzip.exe to zip it up. is there a parameter with which to force a
> buffer flush? here's the relevant code:
The easiest way to have an appender flush automatically is setting
its autoflush property:
log4perl.appender.Logfile.autoflush = 1
What I find puzzling is that both Log::Dispatch::File and Log4perl's native
file appender Log::Log4perl::Appender::File have autoflush *on* by default.
You might want to make sure the log message actually gets through
Log4perl's filtering mechanisms (level, category).
-- Mike
Mike Schilli
m...@pe...
>
> =============================
> use Log::Log4perl qw(get_logger :levels);
>
> our $logger = get_logger();
> $logger->level($INFO);
> my $appender = Log::Log4perl::Appender->new(
> "Log::Dispatch::File",
> filename => "$pdir\\Logs\\${date}_${jobname}.log",
> mode => "append",
> );
> $logger->add_appender($appender);
> my $layout = Log::Log4perl::Layout::PatternLayout->new("%d %p> %F{1}:%L
> %M - %m%n");
> $appender->layout($layout);
> =============================
>
>
|