in reply to Date in Filename
Then you could include that in a file name, and open STDERR to it:my( $sec, $min, $hour, $mday, $mon, $year ) = gmtime; my $datestamp = sprintf "%04d%02d%02d-%02d%02d", $year+1900, $mon+1, $mday, $hour, $min, $sec;
Thereafter, all writes to stderr (including from warn and die) will go to that file.my $error_log = "error-$datestamp"; open STDERR, "> $error_log" or warn "Error redirecting stderr to $error_log: $!\n";
jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re(2): Date in Filename
by chip (Curate) on May 19, 2003 at 16:08 UTC | |
by jdporter (Paladin) on May 19, 2003 at 18:22 UTC | |
by benn (Vicar) on May 19, 2003 at 16:52 UTC |