diff options
author | Peter Palfrader <peter@palfrader.org> | 2003-01-14 06:40:24 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2003-01-14 06:40:24 +0000 |
commit | de0bd086333426c994a97addfcdfc7365c14fdf7 (patch) | |
tree | d3a8a50bb4a834ad6e2cc702cf34f4c4fcfd417b /pingd | |
parent | e00e832d440e065e66858155264d0e79cfd3df23 (diff) |
Make logging configureable
redirect stdout/err to the logfile rather than "outfile" (nothing should ever get there);
redirect stderr to /dev/null when calling Mixmaster
Diffstat (limited to 'pingd')
-rwxr-xr-x | pingd | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -3,7 +3,7 @@ $| = 1; # (c) 2002 Peter Palfrader <peter@palfrader.org> -# $Id: pingd,v 1.88 2003/01/14 06:27:41 weasel Exp $ +# $Id: pingd,v 1.89 2003/01/14 06:40:24 weasel Exp $ # =pod @@ -307,7 +307,8 @@ sub setSigHandlers() { if ($redirected_stdio) { close STDOUT; close STDERR; - open (STDOUT, ">>output") or die ("Cannot open 'output' as STDOUT\n"); + my $logfile = Echolot::Config::get()->{'logfile'}; + open (STDOUT, ">>$logfile") or die ("Cannot open '$logfile' as STDOUT\n"); open (STDERR, ">&STDOUT") or die ("Cannot dup STDOUT as STDERR\n"); }; Echolot::Log::reopen(); @@ -666,7 +667,8 @@ if ($COMMAND eq 'add' || $COMMAND eq 'delete') { exit(0) if (fork()); POSIX::setsid(); exit(0) if (fork()); - open (STDOUT, ">>output") or die ("Cannot open 'output' as STDOUT\n"); + my $logfile = Echolot::Config::get()->{'logfile'}; + open (STDOUT, ">>$logfile") or die ("Cannot open '$logfile' as STDOUT\n"); open (STDERR, ">&STDOUT") or die ("Cannot dup STDOUT as STDERR\n"); open (STDIN , "</dev/null") or die ("Cannot open /dev/null as STDIN\n"); $redirected_stdio = 1; |