Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How to log all output from a program?

by bart (Canon)
on Oct 15, 2007 at 10:37 UTC ( [id://644882]=note: print w/replies, xml ) Need Help??


in reply to How to log all output from a program?

I have no neat solution for you, just some general remarks...

Tieing filehandles when calling external programs just doesn't work. I bet that is why IPC::Run dies.

What does work for external programs, is redirecting these filehandles to files, or to real filehandles. Child programs will then inherit these filehandles. For example:

open STDOUT, ">stdout.txt"; open STDERR, ">stderr.txt"; system($commandline);
Now the command will send its output to stdout.txt and stderr.txt respectively.

So, what to do...? I'm thinking of using an intermediate program/script, which captures the output from your external program (perhaps with IPC::Open3), reformats it, and prints it out, formatted, to the real log file.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://644882]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-26 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found