[Catalyst] Multiple instances of same app with 5.80 under mod_perl

Tomas Doran bobtfish at bobtfish.net
Mon Jun 1 12:08:22 GMT 2009

Matthias Dietrich wrote:
> Hi,
>> One solution to this would be to keep a hash of log class instances 
>> per vhost, and then ensure to replace the logger being used at the 
>> start of each hit - this should do what you're looking for..
> yes, I thought I have to do it in such a way.  Where would be the best 
> point to get the right logger?

I'm thinking something like this:

     my %loggers;
     after prepare => sub {
         my $class = shift;
         my $host = $c->req->hoatname
	my $logger = $loggers{host} ||= My::Logger->new( logfile => 
$class->path_to('logs', "$host.log") );
         $class->log( $logger );



More information about the Catalyst mailing list