nikmit has asked for the wisdom of the Perl Monks concerning the following question:
I have a daemon process which keeps a Dancer instance up, as well as periodically runs some tests in a child process.
That daemon is logging fine with log4perl, config as follows:
my $conf = q( log4perl.category.ess2_loader=DEBUG, LOGFILE log4perl.category.Tools=INFO, LOGFILE log4perl.appender.LOGFILE=Log::Log4perl::Appender::File log4perl.appender.LOGFILE.filename=/var/log/error.log log4perl.appender.LOGFILE.mode=append log4perl.appender.LOGFILE.layout=PatternLayout log4perl.appender.LOGFILE.layout.ConversionPattern=%d %P [%r] %F % +L %c - %m%n ); Log::Log4perl::init( \$conf );
In the daemon itself I get a logger with my $log = Log::Log4perl::get_logger("supervisor"); and that works as expected.
I can't get logging to work in modules, annoyingly with one exception - when the supervisor spawns a child to run tests, that child executes a module which calls a logger like my $log = Log::Log4perl::get_logger("Tools::run_tests"); That again works ok
Trying to repeat that in other modules, by adding a category in the main config and then getting a logger in the same way fails - I get an empty logger where only the category is defined.
I don't know what I'm missing, it probably is too obvious for me to get it...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Gettign a logger with Log::Log4perl
by Anonymous Monk on Oct 31, 2016 at 10:51 UTC | |
by nikmit (Sexton) on Oct 31, 2016 at 11:28 UTC | |
by duyet (Friar) on Oct 31, 2016 at 12:52 UTC | |
by nikmit (Sexton) on Oct 31, 2016 at 16:04 UTC | |
by GotToBTru (Prior) on Oct 31, 2016 at 12:51 UTC | |
|
Re: Gettign a logger with Log::Log4perl
by nikmit (Sexton) on Oct 31, 2016 at 10:32 UTC |