You need to make sure fileno(STDERR) is equal to 2.
fileno()==0 will be used as the child's STDIN.
fileno()==1 will be used as the child's STDOUT.
fileno()==2 will be used as the child's STDERR.
The above will allow you to redirect STDERR to a file, but system file handles (as opposed to Perl file handles) can't be redirected to a Perl function (such as the log4perl handler). If you wish to do that, you'll have to use a temporary file, IPC::Open3 or something like pc88mxer's code.
In reply to Re^3: Daemon, log4perl & stderr/stdout
by ikegami
in thread Daemon, log4perl & stderr/stdout
by saberworks
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |