Log::Log4perl::Appender::DBIx::Class - appender for DBIx::Class
my $dbic_appender = Log::Log4perl::Appender->new( 'Log::Log4perl::Appender::DBIx::Class', schema => $schema, class => 'Message', ); $log->add_appender($dbic_appender); $log->error('Hello!');
This is a specialized Log4perl appender that allows you to log to with DBIx::Class. Each appender can use a different (or the same) class and each column is configurable.
These can be supplied to Appender's new method.
new
The schema object or class to use. If a class is passed instead of an object, connect will be called with the connect_info passes as connection args.
The resultset class to use for logging. Defaults to 'Log'.
The column in which to store the Log4perl category. Defaults to 'category'.
Argument passed to connect if an unconnected schema was passed.
The column in which to store the Log4perl level. Defaults to 'level'.
The column in which to store the Log4perl message. Defaults to 'message'. In case you are wondering (I was), this column WILL received the formatted message as defined by the appender's layout.
This parameter allows you to pass in an arrayref of arbitrary column names. At the time the row is created, this arrayref will be iterated over and any column names will be set:
foreach my $col (@{ $self->{column_names}}) { $row->$col($self->{$col}); }
This allows you to specificy arbitrary options when you create the appender and have the logged in any rows created. An example is in order:
my $appender = Log::Log4perl::Appender->new( 'Log::Log4perl::Appender::DBIx::Class', schema => $schema, class => 'Message', user => 'someuser', other_columns => [qw(user)] );
This will cause any Message objects that are logged to have their user column set to 'someuser'.
user
Cory G Watson <gphat@cpan.org>
Arthur Axel "fREW" Schmidt
Log::Log4perl, DBIx::Class
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Log::Log4perl::Appender::DBIx::Class, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Log4perl::Appender::DBIx::Class
CPAN shell
perl -MCPAN -e shell install Log::Log4perl::Appender::DBIx::Class
For more information on module installation, please visit the detailed CPAN module installation guide.