andreas1234567 has asked for the wisdom of the Perl Monks concerning the following question:
Log entry sample# Module id = Log::Log4perl INST_VERSION 0.37 # Module id = HTML::Mason INST_VERSION 1.23 # This is perl, v5.6.1 built for i386-linux # Server version: Apache/1.3.23 (Unix) (Red-Hat/Linux) package MyLogger; use Log::Log4perl; Log::Log4perl->init("/opt/app/log4perl.conf"); my ($log, $module_name); sub new { my MyLogger $self = shift; unless (ref $self) { $self = fields::new ($self); } $module_name = shift; $log = Log::Log4perl->get_logger($module_name); # compensate for this wrapper class by adding 1 $Log::Log4perl::caller_depth++; return $self; } sub debug{ my ($self, $logmsg) = @_; $log->debug($logmsg) if ($log->is_debug()); }
Expected log entry:2004/01/15 10:48:27 DEBUG> /usr/lib/perl5/site_perl/5.6.1/HTML/Mason/C +omponent.pm:134 [7674] stop
Any clues how to make Log4perl report my real source in the log when called from a Mason component?2004/01/15 10:48:27 DEBUG> /opt/app/root_dir/login_:13 [7674] stop
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Log::Log4perl wrapper + Mason - wrong source file in log
by RMGir (Prior) on Jan 15, 2004 at 15:21 UTC | |
by andreas1234567 (Vicar) on Jan 15, 2004 at 15:56 UTC |