<br><br><div class="gmail_quote">On Thu Nov 13 2014 at 20:22:51 Aristotle Pagaltzis <<a href="mailto:pagaltzis@gmx.de" target="_blank">pagaltzis@gmx.de</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Adam,<br>
<br>
* Adam Witney <<a href="mailto:awitney@sgul.ac.uk" target="_blank">awitney@sgul.ac.uk</a>> [2014-11-13 12:45]:<br>
> I saw this post, but I 'm not sure I can use it to get the Catalyst<br>
> normal startup output in my logs. Is this possible?<br>
<br>
The problem with redirecting this stuff is that Catalyst produces the<br>
debug output very early during its startup, before it has loaded any<br>
extensions or plugins, so the logging facilities are the built-in stuff.<br>
(Hm, maybe it is possible to load the logging-related modules yourself<br>
and then hack them in with BEGIN or some such.) The code to produce this<br>
output is part of the startup code and not well accessible separately<br>
(which is the whole reason for CatalystX::Info after all).<br>
<br><br></blockquote><div><br></div><div>I've had success with this sort of approach, by overriding finalize_config in the base class:</div><div><br></div><div> =head2 finalize_config</div><div><br></div><div>After config merging is complete initialise log4perl as our logger and enrich the available version info</div><div><br></div><div>=cut</div><div><br></div><div>sub finalize_config {</div><div> my $class = shift;</div><div><br></div><div> $class->next::method(@_);</div><div><br></div><div> $class->log( Log::Log4perl::Catalyst->new( $class->config->{logfile} ) );</div><div><br></div><div> my $visible_version = $class->_describe_version;</div><div> $class->config->{version} = $visible_version;</div><div> $class->log->info( "Starting version: [" . $visible_version->{name} . "]" );</div><div>}</div><div><br></div><div>Something like that should do what you need.</div><div><br></div><div>--</div><div>Scott</div></div>