[Catalyst] Log::Log4perl::Catalyst

Duncan Garland Duncan.Garland at motortrak.com
Wed May 15 15:54:06 GMT 2013


Hi,

Has anybody got some examples about how to use this.

It looks like you just have to put the following lines in the main package before __PACKAGE__->setup():

use Log::Log4perl::Catalyst;
__PACKAGE__->log(Log::Log4perl::Catalyst->new('/path/to/log4perl.conf'));

That works up to a point in that the log messages are formatted as I want. However they always go to the STDERR and not to the file given in log4perl.conf. I've used the conf file in a test, so I know it works outside Catalyst. I'm using the Catalyst development server, does that over-ride the logger?

The other thing is that I don't really want to hardcode the filename. It should be in the application's conf file. However, if I just stick it in there as so:

 <Log4perl>
  conf_file /var/www/mymercedesservice.co.uk/fcgi/catalyst/mbfl2/lib/mbfl2/log4perl.conf
</Log4perl>

I can't access it via __PACKAGE__->config->{Log4perl}->{conf_file};
until after setup() has run.

Does that matter?

Thanks

Duncan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20130515/5cbfe33a/attachment.htm


More information about the Catalyst mailing list