I want Emulate.pm's logging behavior to be determined by the Log4perl conf file of the program calling on Emulate.pm.
If Emulate.pm isn't doing anything OO-ish then something like the following should work (untested):
package Emulate; use Log::Log4perl; my $Logger = Log::Log4perl->get_logger( __PACKAGE__ ); ... sub something_that_needs_to_log { $Logger->info('Foo'); }
If Emulate.pm is implementing a class, especially one that's likely to be subclassed, you need to be a little bit more careful about just using __PACKAGE__ as the logging category passed to get_logger(). See the section "Pitfalls with Categories" in the Log::Log4perl docs for more info.
In reply to Re: Log4perl with my module
by adrianh
in thread Log4perl with my module
by queeg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |