Excalibor has asked for the wisdom of the Perl Monks concerning the following question:
Dear brother monks,
I have a program that's supposed to be daemon. Proc::Daemon works nicely for that.
But it's also supposed to leave logs. The whole of the project (of which this daemon is just a part) uses Log::Log4perl and we are very happy with it.
However there's something in Proc::Daemon::Init() that's spoiling Log::Log4perl...
Example follows:
use Log::Log4perl qw(get_logger); use Proc::Daemon; Log::Log4perl->init_and_watch( '/tmp/test_log_daemon.conf', 10 ); # Proc::Daemon::Init(); while (1) { my $logger = get_logger('TEST'); $logger->debug("Testing..."); sleep 5; } __END__ log4perl.rootLogger = DEBUG, FileAppndr1 log4perl.logger.TEST = DEBUG log4perl.appender.FileAppndr1 = Log::Log4perl::Appender::File log4perl.appender.FileAppndr1.filename = /tmp/test_log_daemon.log log4perl.appender.FileAppndr1.mode = append log4perl.appender.FileAppndr1.umask = 0006 log4perl.appender.FileAppndr1.layout = PatternLayout log4perl.appender.FileAppndr1.layout.ConversionPattern = %d{ISO8601} % +H %p> [%c] %F{1}(%L) %M - %m%n
The contents of the config file are shown... If you tail -f the log file, as it's now, it works, but if you uncomment the Init() line, it remains quiet. Other examples, reopening STDERR and using warn and SIGHUP and other tricks, do work, but I haven't manged to make Log::Log4perl work...
Any help really appreciated... Thanks!
--
our $Perl6 is Fantastic;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Proc::Daemon and Log::Log4perl
by shmem (Chancellor) on Jun 28, 2006 at 11:48 UTC | |
by jasonk (Parson) on Jun 28, 2006 at 13:08 UTC | |
by Excalibor (Pilgrim) on Jun 28, 2006 at 13:19 UTC | |
|
Re: Proc::Daemon and Log::Log4perl
by Corion (Patriarch) on Jun 28, 2006 at 11:44 UTC |