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...
In reply to Gettign a logger with Log::Log4perl by nikmit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |