On Tue, 13 Jun 2006, John ORourke wrote:
> The problem is, that normal lines come out like this: (note that Apache
> adds the date/time and level)
>
> "[Tue Jun 13 16:02:21 2006] [info] DataSite::Payment::new - successfully
> loaded WorldPay"
> (ie. that is the "%M - %m" layout I've specified)
>
> but debug messages come out like this:
>
> "[Tue Jun 13 16:02:21 2006] [debug] ApacheLog.pm(95):
> Apache2::ScriptSite::authen - entered handler"
> (looks like a PatternLayout of "%F(%L): %M - %m")
Strange. I'm not quite sure if the apache logger does anything to
the message, but if you use the simple file appender of the
Log::Dispatch hierarchy (just for the sake of demonstrating, otherwise
I'd use Log4perl's file appender), as in
use Log::Log4perl qw(get_logger :levels);
my $rootlog=get_logger('');
$rootlog->level($DEBUG);
my $appender=Log::Log4perl::Appender->new( "Log::Dispatch::File",
name=>'apache log', min_level=>'debug', filename => "foo.txt",
mode => "append");
$appender->layout(Log::Log4perl::Layout::PatternLayout->new('%M - %m%n'));
$rootlog->add_appender($appender);
$rootlog->debug("debug message");
$rootlog->error("error message");
you'll see
main:: - debug message
main:: - error message
in the logfile as expected. Note that I've added "%n" to the layout to
include a line break.
Mike Schilli
m...@pe...
|