You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Kitching Simon <Si...@orange.ch> on 2001/02/20 10:35:16 UTC
RE: Regarding Log File size and logging different messages to dif
fere nt appenders.
> -----Original Message-----
> From: Ceki Gülcü [SMTP:cgu@qos.ch]
> Sent: Monday, February 19, 2001 10:51 PM
> To: log4j-user@jakarta.apache.org
> Cc: naveen.veluri@tgslc.org
> Subject: Re: Regarding Log File size and logging different messages
> to differe nt appenders.
>
> At 14:36 19.02.2001 -0600, you wrote:
> >Hi,
> > I was looking on the log4j API and wanted help on two questions.
> >
> >Regarding logging the messages after reading from an XML file :
> >1. how can we restrict the number of messages we can log and can we
> format
> >messages to a new file after some limit to the existing log file or is
> there
> >a better way performance wise.
>
> Have you looked at the RollingFileAppender?
>
>
> >2. Also i want to log different messages to different Appenders. For
> example
> >say 3 appenders - console, file and NTEventLog and I wanna log debug and
> >info to console, info and warning to file and Error and fatal messages to
> >NTEventLog then how do we organise these things with XML file and also
> with
> >source.
[Kitching Simon]
You can set a threshold on each appender, which means that the
appender
will discard all messages lower than the threshold. So if it is
acceptable to
send *debug and above* to console, *info and above* to file and
*error and above*
to NTEventLog, then this is easy. To set a threshold in an xml
config file, try:
<param name="Threshold" value="INFO" /> within the Appender
definition.
If you really want exactly what you described above, then you can
use the
PriorityRangeFilter filter class that I posted a while ago (search
the email
archives). It hasn't (yet?) been put into log4j cvs.
Cheers,
Simon
> Poke around the distribution as it contains many examples configuration
> files in XML. Regards, Ceki
>
> ps: log4-dev was the wrong mailing list to place your request.
>
>
>
> ----
> Ceki Gülcü Web: http://qos.ch
> av. de Rumine 5 email: cgu@qos.ch (preferred)
> CH-1005 Lausanne ceki_gulcu@yahoo.com
> Switzerland Tel: ++41 21 351 23 15
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org