Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by shmem (Chancellor)
on Oct 15, 2007 at 08:50 UTC ( [id://644864]=note: print w/replies, xml ) Need Help??


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

Ah, of course. But you also can do that from the outside :-)

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.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
  • Comment on Re^3: How to log all output from a program?

Replies are listed 'Best First'.
Re^4: How to log all output from a program?
by salva (Canon) on Oct 15, 2007 at 09:10 UTC
    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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-23 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found