Hello, In your daemon script,you can re-direct the STDIN/STDOUT/STDERR to the null device like '/dev/null'.
open (STDIN, "</dev/null"); open (STDOUT, ">/dev/null"); open (STDERR,">&STDOUT"); Then you can redefine the 'warn' and 'die' handler to the subroutines written by yourself.In these subroutines,you log all events to files. $SIG{__DIE__}=\&log_die; $SIG{__WARN__}=\&log_warn; sub log_die { my $time=scalar localtime; open (HDW,">>",$err_log); print HDW $time," ",@_; close HDW; die @_; } sub log_warn { my $time=scalar localtime; open (HDW,">>",$err_log); print HDW $time," ",@_; close HDW; } Hope this helps. -----Original Message----- >From: Ken Foskey <[EMAIL PROTECTED]> >Sent: Aug 29, 2006 10:06 AM >To: Beginners List <beginners@perl.org> >Subject: STDOUT and STDERR to same file > >I have a daemon process that works but I am currently running it with > > script.pl > error.log 2>&1 > >and I want to do the same thing without using the redirection,, remove >the human error when starting the program. > >I can `open( STDERR, '>', 'error.log') ...` but is there a piece of >magic to duplicate that to STDOUT as well (ie same file output) > >Ta >Ken Foskey > > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] ><http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- Jeff Pang NetEase AntiSpam Team http://corp.netease.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>