Re: printing die error ina file

2006-03-21 Thread Mr. Shawn H. Corey
Jeff Pang wrote: using a logging facility (either RYO or a syslog interface) to log, using that interface to write both the data and the errors I'm interested in (which may be differnt from what Perl sees fit to write to STDERR) to the appropriate files, and redirecting STDERR to /dev/null so it

Re: printing die error ina file

2006-03-21 Thread Mr. Shawn H. Corey
Jay Savage wrote: As for simply redirecting STDERR, most people don't really want to do this with a daemon. If you're using strictures and warnings, you expect many daemons to produce hundres, possibly thousands, of lines of warnings, depending on the purpose of the daemon, how busy it is, and ho

Re: printing die error ina file

2006-03-21 Thread Jeff Pang
>using a logging facility (either RYO or a syslog interface) to log, >using that interface to write both the data and the errors I'm >interested in (which may be differnt from what Perl sees fit to write >to STDERR) to the appropriate files, and redirecting STDERR to >/dev/null so it doesn't clutte

Re: printing die error ina file

2006-03-21 Thread Jay Savage
On 3/21/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > Jeff Pang wrote: > >> So why wouldn't you redirect STDOUT and STDERR to this file too? Many > >> other Perl's errors, like division by zero, are not handle via die or > >> warn. And these messages are printed out even if encountered in an

Re: printing die error ina file

2006-03-21 Thread Mr. Shawn H. Corey
Jeff Pang wrote: So why wouldn't you redirect STDOUT and STDERR to this file too? Many other Perl's errors, like division by zero, are not handle via die or warn. And these messages are printed out even if encountered in an eval. When operating the files (including opening and writing and cl

Re: printing die error ina file

2006-03-20 Thread Jeff Pang
> >So why wouldn't you redirect STDOUT and STDERR to this file too? Many >other Perl's errors, like division by zero, are not handle via die or >warn. And these messages are printed out even if encountered in an eval. > When operating the files (including opening and writing and closing),you ha

Re: printing die error ina file

2006-03-20 Thread Mr. Shawn H. Corey
Jeff Pang wrote: I turned off the STDOUT/STDERR in my program in order to avoid the > possible mussy error-infos appearing on screen.While I wouldn't > lose the valuable infos,since I re-defined both signal 'die' > and 'warn' handler and wrote the results to files. -- Jeff Pang NetEase AntiSp

Re: printing die error ina file

2006-03-20 Thread Jeff Pang
>But why would you do that? If >something went wrong, you could not determine what. > I turned off the STDOUT/STDERR in my program in order to avoid the possible mussy error-infos appearing on screen.While I wouldn't lose the valuable infos,since I re-defined both signal 'die' and 'warn' handle

Re: printing die error ina file

2006-03-20 Thread Mr. Shawn H. Corey
Jeff Pang wrote: * If it's started in a terminal, the output will appear in that terminal, even if started in background and with nohup(1). * If it's started by cron(1), the output is gathered and e-mail to you when the program terminates. * If it's started by init(1), the output is send to

Re: printing die error ina file

2006-03-20 Thread Jeff Pang
> >* If it's started in a terminal, the output will appear in that >terminal, even if started in background and with nohup(1). > >* If it's started by cron(1), the output is gathered and e-mail to you >when the program terminates. > >* If it's started by init(1), the output is send to the consol

Re: printing die error ina file

2006-03-20 Thread Mr. Shawn H. Corey
Jeff Pang wrote: open (HDW,">>",$err_log) or die "Can't open log file $err_log: $!\nError: "[EMAIL PROTECTED]; print HDW $time," ",@_ or die "Can't write to log file $err_log: $!\n Error: "[EMAIL PROTECTED]; Thanks,Jay,you are more exactly. I don't use the

Re: printing die error ina file

2006-03-20 Thread Jeff Pang
>open (HDW,">>",$err_log) >or die "Can't open log file $err_log: $!\nError: "[EMAIL > PROTECTED]; >print HDW $time," ",@_ >or die "Can't write to log file $err_log: $!\n Error: "[EMAIL > PROTECTED]; Thanks,Jay,you are more exactly. I don't use the 'or di

Re: printing die error ina file

2006-03-20 Thread Mr. Shawn H. Corey
Jay Savage wrote: Actually, you probably want that to be: $SIG{__DIE__}=\&log_die; sub log_die { my $time=scalar localtime; open (HDW,">>",$err_log) or die "Can't open log file $err_log: $!\nError: "[EMAIL PROTECTED]; print HDW $time," ",@_

Re: printing die error ina file

2006-03-20 Thread Jay Savage
On 3/19/06, Jeff Pang <[EMAIL PROTECTED]> wrote: > > >How do I log die errors and exit nicely. > > > Hi,you could re-defined signal die handler,for example: > > $SIG{__DIE__}=\&log_die; > sub log_die > { > my $time=scalar localtime; > open (HDW,">>",$err_log); > print HDW $time," ",@_;

Re: printing die error ina file

2006-03-19 Thread Jeff Pang
>How do I log die errors and exit nicely. Hi,you could re-defined signal die handler,for example: $SIG{__DIE__}=\&log_die; sub log_die { my $time=scalar localtime; open (HDW,">>",$err_log); print HDW $time," ",@_; close HDW; die @_; } when your program call the 'die',it s