Subject: | defaultFile => 1 does not behave as expected |
The following code reproduces the bug:
#!/usr/bin/perl -w
use strict;
use File::Log;
my $log = new File::Log (debug => 4,
logFileName => "foo.log",
dateTimeStamp => 1,
logFileMode => '>',
stderrRedirect => 1,
defaultfile => 1,
logFileDateTime => 0,
appName => "$0",
PIDstamp => 1,
storeExpText => 1,
);
$| = 1;
print "print\n";
print("print()\n");
print STDOUT "print STDOUT\n";
warn "warn\n";
print STDERR "print STDERR\n";
$log->msg(1, "log message\n");
$log->exp("log exception\n");
die("goodbye\n");
=head2 expected vs. actual result
Expected contents of foo.log:
print
print()
print STDOUT
warn
print STDERR
7239 Thu Aug 18 17:55:52 2005 log message
** 7239 Thu Aug 18 17:55:52 2005 log exception
goodbye
Actual contents of foo.log
print() on unopened filehandle LF at /home/shimon/perl/file_log_test.pl line 20.
print() on unopened filehandle LF at /home/shimon/perl/file_log_test.pl line 21.
warn
print STDERR
7239 Thu Aug 18 17:55:52 2005 log message
** 7239 Thu Aug 18 17:55:52 2005 log exception
goodbye
print STDOUT
Unexpected behavior:
=over
=item 1
Cannot print to the currently selected output filehandle (STDOUT)
=item 2
When STDOUT is specified, it is not printed to the log file at the "correct" time
=back
=head2 Perl version
This is perl, v5.8.6 built for i386-linux-thread-multi
=head2 Operating system
Linux localhost.localdomain 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 i686 i386 GNU/Linux
=cut