in reply to Re: Wrapper class for log4perl redirects to wrong log file
in thread Wrapper class for log4perl redirects to wrong log file

PodMaster, I humbly thank you for your prompt reply.
Module id = Log::Log4perl INST_VERSION 0.41
Upgrading seems to have no impact on current issue.

PodMaster: what you've posted pretty much works as it should

I agree. I ran your code and it worked as expected. Except when it comes to Apache/mod_perl/mason components. Has anyone successfully used Log::Log4perl in a similar setting?

index.mas:
my $log = MyLogger::->new("apache"); $log->fatal("This should be in the APACHE log"); my $retval = database::do_some_logging(); $log->fatal("This should be in the APACHE log");
database.pm:
my $log = MyLogger::->new("database"); sub do_some_logging { $log->warn("This should appear in DATABASE log." +); }
database.log:
[empty]
apache.log (edited for readability)
FATAL> This should be in the APACHE log WARN> This should appear in DATABASE log. FATAL> This should be in the APACHE log

Replies are listed 'Best First'.
Re: Re: Re: Wrapper class for log4perl redirects to wrong log file
by PodMaster (Abbot) on Feb 09, 2004 at 17:17 UTC
    I just ran it in a mason component without any issues (not that there should've been any). Try restarting apache, maybe something is getting cached or something something (works for me, i suggest you post on the mason/log4perl mailing lists).

    If setting up a singleton is all you were after (which apparently you were), log4perl already does that (which cees demonstrated).

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.