|XP is just a number|
How to log all output from a program?by absolut.todd (Monk)
|on Oct 15, 2007 at 07:21 UTC||Need Help??|
absolut.todd has asked for the wisdom of the Perl Monks concerning the following question:
I am writing an application that uses a large number of custom scripts and CPAN modules together. As part of the requirements for the project, I need to be able to log all the output from the program, both STDOUT and STDERR.
I am using this module that I have written:
And early in the program I declare:
And this generally works correctly, outputting to STDOUT gets appended to the error log with OUT at the start of the line and STDERR gets appended to the error log with ERR and the start of the line.
But there is a problem; one of the CPAN modules (Cvs) relies on IPC::Run which dies when STDERR and STDOUT are captured like this.
FWIW the actual error message is
Can't call method "slave" on an undefined value at /home/FCS/teh/perl/lib/perl5/site_perl/5.8.5/IPC/Run.pm line 2816
IPC::Run's verion is $VERSION = " 0.80";
Is there something crazy with what im trying to do?
A suggestion of a better way to catch STDOUT and STDERR would be appreciated if there is any... Unfortunatly, Log4Perl is not an option.