DaWolf has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to prepend every error msg with date and time. Is it possible? I know how to do it in an ordinary string, but can I tell Perl that every STDERR should be formatted in this way?# The aaplication begins with: my $err_file = "error.log"; open(ERRLOG, "+>>logs/system/$err_file"); flock(ERRLOG,2); *STDERR = *ERRLOG; # and ends with: flock(ERRLOG,8); close(ERRLOG);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Formatting STDERR
by Corion (Patriarch) on Feb 12, 2004 at 10:00 UTC | |
by Abigail-II (Bishop) on Feb 12, 2004 at 10:09 UTC | |
|
Re: Formatting STDERR
by leriksen (Curate) on Feb 12, 2004 at 10:11 UTC | |
|
Re: Formatting STDERR
by nite_man (Deacon) on Feb 12, 2004 at 10:47 UTC | |
|
Re: Formatting STDERR
by Roy Johnson (Monsignor) on Feb 12, 2004 at 16:11 UTC |