|
From: Mike S. <m...@pe...> - 2009-10-05 15:36:57
|
On Mon, 5 Oct 2009, Ronald Fischer wrote:
> The "file switching" is done using the following code:
>
> Log::Log4perl->appender_by_name($requestlogger_appender_name)-
> >file_switch($relpathname);
You might be running out of file handles due to a bug fixed in release
1.25. Please make sure you run the latest Log4perl from CPAN.
-- Mike
Mike Schilli
m...@pe...
> We recently found that once in a while (every couple of hours),
> File.pm crashes on a write operation. By inserting a suitable check,
> we found that the file handle happens to be undef in
> File::Appender::log().
>
> The logger in question is a bit unusual in that it undergoes frequent
> file switches - frequent means that
> on times there might be even serveral file switches per second.
>
> The appender is defined by passing a reference to a string to
> Log::Log4perl::init(), like this:
>
> init(\ qq(
> ...
> log4perl.appender.Reqlog=Log::Log4perl::Appender::File
> log4perl.appender.Reqlog.name=$requestlogger_appender_name
> log4perl.appender.Reqlog.filename=$initial_reqlog
> log4perl.appender.Reqlog.mode=append
> log4perl.appender.Reqlog.layout=Log::Log4perl::Layout::PatternLayout
> log4perl.appender.Reqlog.layout.ConversionPattern=%.5p
> %d{HH:mm:ss} %M(%L) %m%n
> ...
> ));
>
> The variables interpolated into this string are defined as follows:
>
> use File::Spec::Functions qw(devnull);
> my $initial_reqlog=devnull; # NUL on Windows
> my $requestlogger_appender_name='ReqlogApp';
>
...
>
> During the lifetime of the program (which runs uninterrupted for days,
> sometimes a few weeks), maybe
> 30-100 files per day are created that way, but the number of file
> switches is considerably higher,
> because sometimes only one or two lines (or even none!) are logged into
> one log file, then a switch to
> another logfile occurs, then a switch back to the first one, etc. I
> mention this, because it might be
> possible that our problems are related to the file switch pattern.
>
> At the moment we have no idea why the file handle suddenly would be
> undef, and we try to research
> further. At the moment, it would already help if someone could point out
> whether
>
> - the problem of "disappearing file handle" has already bee seen before,
> or
> - have a better guess what could be the cause of our problem (maybe
> Windows gets upset
> due to so many "opening and closing of files"?)
>
> Ronald
>
>
>
>
> --
> Ronald Fischer <ro...@em...>
> + If a packet hits a pocket on a socket on a port,
> + and the bus is interrupted and the interrupt's not caught,
> + then the socket packet pocket has an error to report.
> + (cited after Peter van der Linden)
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> log4perl-devel mailing list
> log...@li...
> https://lists.sourceforge.net/lists/listinfo/log4perl-devel
>
|