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'; The "file switching" is done using the following code: Log::Log4perl->appender_by_name($requestlogger_appender_name)->file_switch($relpathname); 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 <rona...@eml.cc> + 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 log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel