logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Hoying <ken_hoy...@yahoo.com>
Subject RE: Having mixed loggers in log4j.xml ?
Date Mon, 10 Nov 2003 18:46:38 GMT
>From reading the documentation, one would certainly
reasonably expect the Threshold parameter to work that
way and I think it does for most appenders.  For some
reason the author of the SMTPAppender seems to have
decided that rather than using the Threshold setting
they would develop their own mechanism for filtering
messages, which while might be more powerful, is also
outside the norm of expected use.  Anyhow enough with
the editorial and on to the details.  You need to to
create your own class that extends the
TriggerEventEvaluator. This class will serve as the
message filter.  It can then be set in your config
file by specifying the class name in a param called
EvaluatorClass.

Best of Luck,
Ken Hoying
  
--- Mandar Mangalvedhekar
<mmangalvedhekar@us-south.net> wrote:
> Yes, I need to send email messages for level INFO
> 
> I have set the threshold level in the appender
> 
> >   <appender name="BNoFileAlert" 
> > class="org.apache.log4j.net.SMTPAppender">
> >   		<param name="Threshold" value="INFO"/>
> > 	........
> >   </appender>
> 
> 
> Is this the right way ?
> 
> Thanks
> Mandar
> 
> -----Original Message-----
> From: Ken Hoying [mailto:ken_hoying@yahoo.com] 
> Sent: Monday, November 10, 2003 12:41 PM
> To: Log4J Users List
> Subject: RE: Having mixed loggers in log4j.xml ?
> 
> 
> The SMTPAppender only send email by default for
> messages of level error or higher.  Are you trying
> to
> email log messages of a lower level than this?
> 
> --- Mandar Mangalvedhekar
> <mmangalvedhekar@us-south.net> wrote:
> > 
> > Here is what is happening.
> > 
> > I have a Emailer (logger name) and I am adding
> > FileAppender and
> > SMTPAppender to this logger.
> > 
> > The SMTPAppender never gets called. The message is
> > getting logged to the
> > file. Both the appenders work if I use a class
> name
> > instead of string.
> > 
> > I am not sure what I am missing.
> > 
> > Here is the log4j.xml file
> > 
> > ---------------------------------------------
> > 
> > <appender name="BFile"
> > class="org.apache.log4j.FileAppender">
> >       <param name="Append" value="true"/>
> >       <param name="File" value="test.log"/>
> >    
> >       <layout
> > class="org.apache.log4j.PatternLayout">
> >         <param name="ConversionPattern"
> > value="%d{ABSOLUTE} %-5p [%c{1}]
> > %m%n"/>
> >       </layout>
> >   </appender>	
> > 
> >    <appender name="BAlert"
> class="org.apache.log4j.net.SMTPAppender">
> >     <param name="Threshold" value="ERROR"/>
> >      ......	
> >   </appender>
> >   
> >   <appender name="BNoFileAlert" 
> > class="org.apache.log4j.net.SMTPAppender">
> >   		<param name="Threshold" value="INFO"/>
> > 	........
> >   </appender>
> > 
> >   <logger name="a.b.c.Main" additivity="false">
> >     <level value="INFO"/>
> >     <appender-ref ref="BFile"/>
> >     <appender-ref ref="BAlert"/>
> >  </logger>	
> >   
> >   <logger name="Emailer" additivity="false">
> >       <level value="INFO"/>
> >       <appender-ref ref="BFile"/>
> >       <appender-ref ref="BNoFileAlert"/>
> >   </logger>	
> > 
> > ---------------------------------------------
> > 
> > Thanks
> > Mandar
> > 
> > 
> > 
> > -----Original Message-----
> > From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com]
> > Sent: Monday, November 10, 2003 12:22 PM
> > To: Log4J Users List
> > Subject: RE: Having mixed loggers in log4j.xml ?
> > 
> > 
> > 
> > Howdy,
> > Yup, it's allowed.  The name is just a String,
> > doesn't have to be a
> > class name.  Of course, if you don't actually have
> > anything that does
> > Logger logger = Logger.getLogger("StringLogger")
> in
> > your code, the
> > StringLogger will never be used and thus is
> > meaningless in the
> > configuration ;)
> > 
> > Yoav Shapira
> > Millennium ChemInformatics
> > 
> > 
> > >-----Original Message-----
> > >From: Mandar Mangalvedhekar
> > [mailto:mmangalvedhekar@us-south.net]
> > >Sent: Monday, November 10, 2003 12:21 PM
> > >To: log4j-user@jakarta.apache.org
> > >Subject: Having mixed loggers in log4j.xml ?
> > >
> > >Hi,
> > > Can we have a mixture of loggers in log4j.xml
> file
> > ?
> > >
> > >Some of the loggers are actual classes in the
> > application
> > >
> > > a.b.c.Test.class
> > >
> > > <logger name="a.b.c.Test">
> > > ...
> > > </logger>
> > >
> > >while some others are plain strings
> > >
> > > <logger name="StringLogger">
> > >  ......
> > ></logger>
> > >
> > >
> > >Is this allowed ?
> > >
> > >Thanks
> > >Mandar
> > >
> > >
> > >
> > 
> > 
> > 
> > This e-mail, including any attachments, is a
> > confidential business
> > communication, and may contain information that is
> confidential,
> > proprietary and/or privileged.  This e-mail is
> > intended only for the
> > individual(s) to whom it is addressed, and may not
> > be saved, copied,
> > printed, disclosed or used by anyone else.  If you
> > are not the(an)
> > intended recipient, please immediately delete this
> > e-mail from your
> > computer system and notify the sender.  Thank you.
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> log4j-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > log4j-user-help@jakarta.apache.org
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> log4j-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > log4j-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard
> http://antispam.yahoo.com/whatsnewfree
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> log4j-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> log4j-user-unsubscribe@jakarta.apache.org
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message