Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: How to log all output from a program?

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


in reply to Re^3: How to log all output from a program?
in thread How to log all output from a program?

BTW, if you open/close the filehandle inside the loop (and perhaps include $$ in the output) it is less probable that multiple processes mess up the logfiles

I don't think so. Usually, the OS provides atomic write operations up to a certain length. If your write operations go over that limit, the way to ensure that data from different processes does not interleave is to lock the file.

Reopening the file on every write allows to rotate the logs from the outside without the current script knowing.

  • Comment on Re^4: How to log all output from a program?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-16 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found