Posted on 2008-08-28 19:14:43-07 by ssinyagin
reopening STDERR in parent process
The Torrus collector reopens STDERR upon SIGHUP: Line 113 in source
my $rotateLogs = sub { Info('Caught SIGHUP. Reopening log file'); close( STDERR ); open( STDERR, ">>$logfile" ); $| = 1; };
After assigning this signal handler, the collector spawns a child thread. The child prints its debugging and error messages to STDERR. The problem appeared that when the logfile is moved and SIGHUP is sent to the process, only the parent process starts to write to the new file. The child thread continues writing to the old file.

How can I organize the logging so that the file rotation is still possible? Would log4perl be of any help?
Direct Responses: 8689 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.