From: Robert J. <yad...@sn...> - 2006-09-26 20:14:42
|
At 02:18 PM 9/22/2006, John ORourke wrote: >I'd recommend writing another appender which wraps around >Appender::DBI and checks for availability. Ok, I've managed to write a basic wrapper (without checking for availability). It seems to work (i.e. messages are logged to the database), but in the Layout I'm using %F{2}, and I get "Log4perl/Logger.pm" instead of the path of my script. Do I need to mess with caller_depth or something? --------------------------------------------- package Mylog; use warnings; use strict; require Log::Log4perl::Appender::DBI; sub new { my ($class, %options) = @_; my $appender = Log::Log4perl::Appender::DBI->new( map { $_ => $options{$_} } keys %options, ); my $self = { appender => $appender, name => $options{name}, }; bless $self, $class; return $self; } sub log { my ($self, %p) = @_; $self->{appender}->log( %p, ); return 1; } 1; --------------------------------------------- -- Rob |