-------- Original Message --------
Subject: AW: AW: Taken from
http://www.perl.com/pub/a/2002/09/11/log4perl. html ?pag e=3D3
Date: 10/13/2003, 1:57 PM
From: "Schmidtchen, Jens" <Jen...@vi...>
To: 'Mike Schilli' <msc...@ao...>
thanks once again. but - believe it or not - both appenders write DEBUG
messages:
[Log4Perl]
log4perl.logger.app =3D DEBUG, A1, A0
log4perl.logger.app.cache =3D DEBUG, A1, A0
log4perl.logger.app.sql =3D DEBUG, A1, A0
log4perl.logger.app.executer =3D DEBUG, A1, A0
log4perl.logger.app.dbsession =3D DEBUG, A1, A0
# Filter to match level ERROR
log4perl.filter.MatchError =3D Log::Log4perl::Filter::LevelMatch
log4perl.filter.MatchError.LevelToMatch =3D ERROR
log4perl.filter.MatchError.AcceptOnMatch =3D true
# Filter to match level DEBUG
log4perl.filter.MatchDebug =3D Log::Log4perl::Filter::LevelMatch
log4perl.filter.MatchDebug.LevelToMatch =3D DEBUG
log4perl.filter.MatchDebug.AcceptOnMatch =3D true
# File-Appender
log4perl.appender.A0 =3D Log::Dispatch::File
log4perl.appender.A0.Filter =3D MatchDebug
log4perl.appender.A0.filename =3D sub {getLogFileName();};
log4perl.appender.A0.mode =3D write
log4perl.appender.A0.layout =3D Log::Log4perl::Layout::PatternLayout
log4perl.appender.A0.layout.ConversionPattern =3D %d %p> %F{1}:%L %M - %m%n
# DB-Appender
log4perl.appender.A1 =3D Log::Log4perl::Appender::DBI
log4perl.appender.A1.Filter =3D MatchError
log4perl.appender.A1.datasource =3D sub {getDBName();};
log4perl.appender.A1.username =3D sub {getDBUser();};
log4perl.appender.A1.password =3D sub {getDBPassWd();};
log4perl.appender.A1.sql =3D sub {getSQLStmt();};
# Bind values for Insert Statement
log4perl.appender.A1.params.1 =3D %c # Category of the logging event
log4perl.appender.A1.params.2 =3D %C # Fully qualified package (or
class) name of the caller
log4perl.appender.A1.params.3 =3D %d{d.M.yyyy HH:mm:s} # Current date in
yyyy/MM/dd hh:mm:ss format
log4perl.appender.A1.params.4 =3D %F{2} # File where the logging event
occurred
log4perl.appender.A1.params.5 =3D %H # Hostname
log4perl.appender.A1.params.6 =3D %L # Line number within the file
where
the log statement was issued
log4perl.appender.A1.params.7 =3D %M # Method or function where the
logging request was issued
log4perl.appender.A1.params.8 =3D %p # Priority of the logging event
log4perl.appender.A1.params.9 =3D %r # Number of milliseconds elapsed
from program start to logging event
log4perl.appender.A1.params.10 =3D %m # The message to be logged
log4perl.appender.A1.layout.dontCollapseArrayRefs =3D 1
log4perl.appender.A1.usePreparedStmt =3D 1
log4perl.appender.A1.layout =3D Log::Log4perl::Layout::PatternLayout
log4perl.appender.A1.layout.ConversionPattern =3D %d %p> %F{1}:%L %M - %m%n
log4perl.oneMessagePerAppender =3D 1
what did i do wrong?
can one get an appender catching messages of more than ONE level (e.g. all
DEBUG AND ERROR messages)?
jens
-----Urspr=FCngliche Nachricht-----
Von: Mike Schilli [mailto:msc...@ao...]
Gesendet: Montag, 13. Oktober 2003 22:11
An: Schmidtchen, Jens
Cc: log4perl-devel
Betreff: Re: AW: Taken from
http://www.perl.com/pub/a/2002/09/11/log4perl.html ?pag e=3D3
Schmidtchen, Jens wrote on 10/13/2003, 12:19 PM:
> could you please let me know, if the following can be achieved at
all? >
assume several (given) classes each of which with their own logger.
Ok, that's pretty common.
> these
> loggers should catch ERRORS only. but in addition all DEBUG messages >
should > be caught too and be recorded into another destination.
To split output by level, use a custom filter, here's the FAQ:
http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl=
=20
/FAQ.html#i_want_to_log_error_and_warn_messages_to_different_files!_how_can_=
=20
i_do_that
You will need to specify the logger's level equal to the lowest priority
of messages, DEBUG in your case, though.
> in general: the
> level of the uppermost logger is less restrictive than the levels of the
> other ones. IMHO the problem is that the uppermost logger can't >
receive
any > DEBUG message from its descendant since they suppress any non-ERROR
> message.
This should be taken care of by the configuration outlined above, right?
--=20
-- Mike
Mike Schilli
m...@pe...
--
-- Mike
Mike Schilli
msc...@ao...
AOL Unified Preferences Engineering
|