How does/should this work when you have split the code into packages?
That's explained in Log::Log4perl
.. you can retrieve logger objects anywhere in the code. Note that there's no need to carry any logger references around with your functions and methods. You can get a logger anytime via a singleton mechanism:
#!/usr/bin/perl
use strict;
package MyModule;
use Log::Log4perl;
my $log = Log::Log4perl->get_logger("MyModule");
sub doit {
$log->info("I'm doing it !");
}
package main;
use Log::Log4perl ':easy';
Log::Log4perl->easy_init();
$log->info("Asking doit");
MyModule->doit();
poj