Okay, here's a code excerpt. I see message "log init a", I do not see message "log init b".
# Daemonizing closes all fds, so must be before log init. # (Which means it's hell to tell why it later aborts.) if ($daemonize) { Proc::Daemon::Init(); } open (my $xxx, ">/nfshome/ddb/p/kcmdproxy/elog.log") or die "Open fail +ed: $!"; print $xxx "opened log file\n"; # Higher-level non-error logging level Log::Log4perl::Logger::create_custom_level('NOTIFY', 'ERROR'); print $xxx "log init a\n"; Log::Log4perl->init_and_watch($logconfig, 'HUP'); print $xxx "log init b\n";
When not daemonizing, it gets through all this and more (the old code works in non-daemon mode). When I daemonize, it dies when I do the log config. And I know why; the default $logconfig is a relative path, and daemonizing sets current directory to /.
As you may gather, I figured that out as I was writing the description.
Thanks!
In reply to Re^2: Daemon dies instantly
by dd-b
in thread Daemon dies instantly
by dd-b
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |