logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xin Zhao <david.z...@gmail.com>
Subject Re: How to config LevelMatchFilter
Date Tue, 01 Nov 2005 17:21:56 GMT
Now I have tried to ues the xml config file as followed. But I still got two
email from log4j when Error Level reached.

Could anyone have a look?

-------------
<appender name="emailWarnLog" class="org.apache.log4j.net.SMTPAppender">
<param name="Threshold" value="WARN"/>
<param name="SMTPHost" value="SMTPMAIL.xxx.COM <http://SMTPMAIL.xxx.COM>"/>
<param name="To" value="David.Zhao@xxxl.com"/>
<param name="From" value="Murex_TMS_Feed"/>
<param name="Subject" value="Ignore one event"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{MMMdd_HHmmss}%5p: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="LevelToMatch" value="WARN"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
</appender>
<appender name="emailErrorLog" class="org.apache.log4j.net.SMTPAppender">
<param name="Threshold" value="ERROR"/>
<param name="SMTPHost" value="SMTPMAIL.xxx.COM <http://SMTPMAIL.xxx.COM>"/>
<param name="To" value="David.Zhao@xxx.com"/>
<param name="From" value="Murex_TMS_Feed"/>
<param name="Subject" value="I am stopped !!"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{MMMdd_HHmmss}%5p: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="ERROR"/>
<param name="LevelMax" value="FATAL"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
</appender>

David

On 11/1/05, James Stauffer <stauffer.james@gmail.com> wrote:
>
> I have never used those so I don't know.
>
> On 11/1/05, Xin Zhao <david.zxem@gmail.com> wrote:
> > In xml file, could you do the cross reference like the followed
> > example (LOG_DIR,
> > CONVERSION_PATTERN)?
> >
> >
> > -------------
> > LOG_DIR ../Log
> > APP_NAME tmsFeed
> > CONVERSION_PATTERN %d{MMMdd_HHmmss}%5p: %m%n
> > log4j.rootLogger INFO, console, log, emailWarnLog
> >
> > log4j.appender.console org.apache.log4j.ConsoleAppender
> > log4j.appender.console.layout org.apache.log4j.PatternLayout
> > log4j.appender.console.layout.ConversionPattern ${CONVERSION_PATTERN}
> > log4j.appender.console.Threshold DEBUG
> >
> > log4j.appender.heartbeat org.apache.log4j.RollingFileAppender
> > log4j.appender.heartbeat.layout org.apache.log4j.PatternLayout
> > log4j.appender.heartbeat.layout.ConversionPattern ${CONVERSION_PATTERN}
> > log4j.appender.heartbeat.File ${LOG_DIR}/${APP_NAME}Heartbeat.log
> > log4j.appender.heartbeat.MaxFileSize 100Kb
> > log4j.appender.heartbeat.MaxBackupIndex 0
> > log4j.appender.heartbeat.Threshold DEBUG
> >
> >
> > David
> >
> > On 11/1/05, James Stauffer <stauffer.james@gmail.com> wrote:
> > >
> > > Why do you want to use a property file instead of an XML file?
> > > Actually in 1.3 there will be a new preferred (and more powerful)
> > > config file format so properties files will be 2 generations old.
> > >
> > > On 11/1/05, Xin Zhao <david.zxem@gmail.com> wrote:
> > > > I think maybe it is a feature they could add into log4j. So we could
> use
> > > the
> > > > Filters in property file like what we do with the layout
> > > >
> > > > log4j.appender.emailWarnLog.layout org.apache.log4j.PatternLayout
> > > >
> > > > David
> > > >
> > > >
> > > > On 11/1/05, Bender Heri <HBender@ergonomics.ch> wrote:
> > > > >
> > > > > IIRC you can't use Filters in property files, only in xml.
> > > > >
> > > > > Heri
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: James Stauffer [mailto:stauffer.james@gmail.com]
> > > > > > Sent: Tuesday, November 01, 2005 4:18 PM
> > > > > > To: Log4J Users List
> > > > > > Subject: Re: How to config LevelMatchFilter
> > > > > >
> > > > > >
> > > > > > I only use XML config so I don't know.
> > > > > >
> > > > > > On 11/1/05, Xin Zhao <david.zxem@gmail.com> wrote:
> > > > > > > No, I only need ERROR level.
> > > > > > >
> > > > > > > And my real question is if i could use the LevelMatchFilter
> > > > > > in plain conifg
> > > > > > > file not xml.
> > > > > > >
> > > > > > > David
> > > > > > >
> > > > > > > On 11/1/05, James Stauffer <stauffer.james@gmail.com>
wrote:
> > > > > > > >
> > > > > > > > Assuming you also want emails for FATAL logs then
you don't
> need
> > > > > > > > LevelMatchFilter. Just setting the Threshold to ERROR
should
> > > work
> > > > > > > > fine.
> > > > > > > >
> > > > > > > > On 11/1/05, Xin Zhao <david.zxem@gmail.com>
wrote:
> > > > > > > > > Sorry, my example is wrong, i should set the
> > > > > > acceptOnMatch to be true.
> > > > > > > > >
> > > > > > > > > I try to send out email only when ERROR level
is reached.
> > > > > > > > >
> > > > > > > > > David
> > > > > > > > >
> > > > > > > > > On 11/1/05, James Stauffer <stauffer.james@gmail.com>
> wrote:
> > > > > > > > > >
> > > > > > > > > > What are you trying to do? It appears that
you only
> > > > > > want ERROR and
> > > > > > > > > > higher but you use LevelToMatch to reject
ERROR.
> > > > > > > > > > Also, I think SMTPAppender has a buffer
so it only
> > > > > > sends an email when
> > > > > > > > > > it has a certain amount of data or there
is an ERROR
> log.
> > > > > > > > > >
> > > > > > > > > > On 11/1/05, Xin Zhao <david.zxem@gmail.com>
wrote:
> > > > > > > > > > > hi all,
> > > > > > > > > > >
> > > > > > > > > > > I am trying to config the SMTPAppender
with
> > > > > > LevelMatchFilter by
> > > > > > > > using
> > > > > > > > > > the
> > > > > > > > > > > plain config file as followed. But
it does not
> > > > > > work. Some one said
> > > > > > > > the
> > > > > > > > > > > LevelMatchFilter only works in XML
config file. Is it
> > > true?
> > > > > > > > > > >
> > > > > > > > > > > -------------------------------------------------
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > log4j.appender.emailWarnLog
> > > > > > org.apache.log4j.net.SMTPAppender
> > > > > > > > > > > log4j.appender.emailWarnLog.SMTPHost
> > > > > > SMTPMAIL.xxx.COM <http://SMTPMAIL.xxx.COM> <
> http://SMTPMAIL.xxx.COM> <http://SMTPMAIL.xxx.COM
> > > ><http://SMTPMAIL.xxx.COM>
> > > > > > > > <http://SMTPMAIL.xxx.COM>
> > > > > > > > > > <http://SMTPMAIL.xxx.COM>
> > > > > > > > > > >
> > > > > > log4j.appender.emailWarnLog.To<http://log4j.appender.emailWarnLog.To>
> <http://log4j.appender.emailWarnLog.To><
> > > http://log4j.appender.emailWarnLog.To><
> > > > > http://log4j.appender.emailWarnLog.To><
> > > > > > > > http://log4j.appender.emailWarnLog.To> <
> > > > > > > > > > http://log4j.appender.emailWarnLog.To>
> > > > > > > > > > > David.Zhao@xxx.com
> > > > > > > > > > > log4j.appender.emailWarnLog.From Murex_TMS_Feed
> > > > > > > > > > > log4j.appender.emailWarnLog.Subject
Ignore one event
> > > > > > > > > > > log4j.appender.emailWarnLog.filter
> > > > > > > > > > org.apache.log4j.varia.LevelMatchFilter
> > > > > > > > > > > log4j.appender.emailWarnLog.filter.LevelToMatch
ERROR
> > > > > > > > > > > log4j.appender.emailWarnLog.filter.AcceptOnMatch
false
> > > > > > > > > > > log4j.appender.emailWarnLog.layout
> > > > > > org.apache.log4j.PatternLayout
> > > > > > > > > > >
> > > > > > > >
> > > > > > log4j.appender.emailWarnLog.layout.ConversionPattern${CONVERSI
> > > > > > ON_PATTERN}
> > > > > > > > > > > log4j.appender.emailWarnLog.Threshold
ERROR
> > > > > > > > > > >
> > > > > > > > > > > David
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > James Stauffer
> > > > > > > > > > Are you good? Take the test at
> > > > > > http://www.livingwaters.com/good/
> > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > > > > To unsubscribe, e-mail:
> > > > > > log4j-user-unsubscribe@logging.apache.org
> > > > > > > > > > For additional commands, e-mail:
> > > > > > log4j-user-help@logging.apache.org
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > James Stauffer
> > > > > > > > Are you good? Take the test at
> http://www.livingwaters.com/good/
> > > > > > > >
> > > > > > > >
> > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail:
> > > log4j-user-unsubscribe@logging.apache.org
> > > > > > > > For additional commands, e-mail:
> > > > > > log4j-user-help@logging.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > James Stauffer
> > > > > > Are you good? Take the test at http://www.livingwaters.com/good/
> > > > > >
> > > > > >
> > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> log4j-user-unsubscribe@logging.apache.org
> > > > > > For additional commands, e-mail:
> log4j-user-help@logging.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > > > For additional commands, e-mail:
> log4j-user-help@logging.apache.org
> > > > >
> > > > >
> > > >
> > >
> > >
> > > --
> > > James Stauffer
> > > Are you good? Take the test at http://www.livingwaters.com/good/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> >
>
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message