Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Daemon dies instantly

by dd-b (Monk)
on Oct 14, 2011 at 23:13 UTC ( [id://931597]=note: print w/replies, xml ) Need Help??


in reply to Re: Daemon dies instantly
in thread Daemon dies instantly

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!

Replies are listed 'Best First'.
Re^3: Daemon dies instantly
by GrandFather (Saint) on Oct 15, 2011 at 01:32 UTC
    As you may gather, I figured that out as I was writing the description.

    Good work dd-b++. And that is why we encourage honing the problem description and sample script - most often you'll figure it out for yourself along the way. ;)

    True laziness is hard work

      I've had prominent personal experiences with that effect since, oh, around 1971 sometime I think!

      What I was hoping to get out of the original post was whether there were known gotchas, easy ways to mess this up and get this symptom. I find it's worth checking, when one can, for this sort of thing.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2024-04-24 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found