From: Mike S. <log...@pe...> - 2003-06-03 15:18:48
|
On Tue, 3 Jun 2003, Gordon Marler wrote: > I've been using Log::Log4perl for several months now, with great success > - great job! Thanks! :) > I've designed my Perl object to contain a reference to a Log::Log4perl > object, and this seems to work for all methods in the object except > DESTROY. Here's an example of what my DESTROY method looks like (the > name of my object and it's package is "BE"): > > sub DESTROY { > my ($self) = @_; > my ($logger) = Log::Log4perl->get_logger("BE"); > $logger->info("Entering DESTROY method for " . __PACKAGE__ . "\n"); > } Hmm ... I'm not quite sure how you're storing references to Log::Logp4erl objects in your object -- there's really no "Log::Log4perl objects". Typically, you call use Log::Log4perl; Log::Log4perl->init(...); at the beginning of your program and then, within your class code, you use package MyClass; use Log::Log4perl; sub method { my ($logger) = Log::Log4perl->get_logger("BE"); $logger->info("message"); } There's really no "Log::Log4perl objects" -- instead, Log4perl uses a singleton mechanism for its loggers. You didn't submit your class' constructor method, so I can only speculate: the problem might be related to storing this "Log::Log4perl reference". Instead, just initialize Log::Log4perl once at the start of the main (!) program and call the loggers in your custom class like shown above, that should fix the problem. Hope that helps! -- Mike Mike Schilli log...@pe... http://perlmeister.com http://log4perl.sourceforge.net |