[Catalyst] Populate Log4perl config from Catalyst perl hooks

Anthony Gladdish anthony.gladdish at newcastle.ac.uk
Mon Apr 22 11:38:33 GMT 2013


>-----Original Message-----
>From: Charlie Garrison [mailto:garrison at zeta.org.au]
>Sent: 22 April 2013 12:26
>To: The elegant MVC web framework
>Subject: Re: [Catalyst] Populate Log4perl config from Catalyst
>perl hooks
>
>Good evening,
>
>On 22/04/13 at 10:25 AM -0000, Anthony Gladdish
><anthony.gladdish at newcastle.ac.uk> wrote:
>
>>Then in my Log4perl config:
>>
>>log4perl.appender.LOGFILE.layout.ConversionPattern=\sub {
>return MyApp::Cat::my_test_hook(); }
>>
>>Unfortunately, this only prints " \sub { return
>MyApp::Cat::my_test_hook(); } " in my log file!
>>
>>Can anyone see how I may be able to fix this?
>
>I don't think you want the escape (backslash); use this instead:
>
>   log4perl.appender.LOGFILE.layout.ConversionPattern=sub {
>return MyApp::Cat::my_test_hook(); }
>
>Or maybe this:
>
>   log4perl.appender.LOGFILE.layout.ConversionPattern=sub {
>require MyApp::Cat; return MyApp::Cat::my_test_hook(); }

No, neither removing the backslash or adding the require statement has worked.

Anthony


More information about the Catalyst mailing list