in reply to Re^2: Daemon, log4perl & stderr/stdout
in thread Daemon, log4perl & stderr/stdout

You'll be running the children in sequence because the parent will be capturing the output from each child until the child terminates before spawning the next child.

As for STDOUT and STDERR when using Proc::Daemon, it just redirects them to /dev/null as a convenience. There's no problem re-opening them to other files. Closing those handles first is not necessary. When attempting to open an already open file handle, perl will close it first.

If the open STDERR ... call is not working in daemon mode, perhaps it's because it can't write to or create "$run_path/stderr.txt". What are the permissions on the directory and file, and what userid is the script running as in daemon mode?

Replies are listed 'Best First'.
Re^4: Daemon, log4perl & stderr/stdout
by saberworks (Curate) on May 28, 2008 at 18:00 UTC
    Great, I misunderstood your code at first, after looking through the manual and your explanation it now makes sense. I'm going to implement it like this and I'll report back the status. Thanks for your time & help.