Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Redirecting logging and STDERR to a single file

by moot (Chaplain)
on Mar 04, 2005 at 17:50 UTC ( [id://436681]=note: print w/replies, xml ) Need Help??


in reply to Redirecting logging and STDERR to a single file

Generally I've found logging direct to a file very limiting (unless the app is running as a daemon and has no terminal). If run from the shell I prefer to redirect using the shell:

./some_script > /some/log
For directing both STDOUT and STDERR you could use this (bash):
./some_script >& /some/log
or this (shells that don't support >&):
./some_script > /some/log 2>&1
making sure to have turned on $| in your script of course.

That way you can see output on the terminal if you wish; filter it; send stdout to /dev/null; or just send all output to the log directly - some of which are difficult to do if your script itself is writing direct to the log.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-25 05:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found