On Thu Nov 13 2014 at 20:22:51 Aristotle Pagaltzis <[email protected]> wrote:
> Hi Adam, > > * Adam Witney <[email protected]> [2014-11-13 12:45]: > > I saw this post, but I 'm not sure I can use it to get the Catalyst > > normal startup output in my logs. Is this possible? > > The problem with redirecting this stuff is that Catalyst produces the > debug output very early during its startup, before it has loaded any > extensions or plugins, so the logging facilities are the built-in stuff. > (Hm, maybe it is possible to load the logging-related modules yourself > and then hack them in with BEGIN or some such.) The code to produce this > output is part of the startup code and not well accessible separately > (which is the whole reason for CatalystX::Info after all). > > > I've had success with this sort of approach, by overriding finalize_config in the base class: =head2 finalize_config After config merging is complete initialise log4perl as our logger and enrich the available version info =cut sub finalize_config { my $class = shift; $class->next::method(@_); $class->log( Log::Log4perl::Catalyst->new( $class->config->{logfile} ) ); my $visible_version = $class->_describe_version; $class->config->{version} = $visible_version; $class->log->info( "Starting version: [" . $visible_version->{name} . "]" ); } Something like that should do what you need. -- Scott
_______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
