Title: SMTPAppender
Here is a XML file where :
    - all categories write logs to DEFAULT appender (the standard output)
    - all categories (but C1) are defined on INFO priority level
    - the category C1 is defined on the ERROR priority. It writes logs to DEFAULT (because it extends the root category) and MAIL appenders
 
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
 <appender name="DEFAULT="org.apache.log4j.FileAppender">
           <param name="File" value="System.out" />
           <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%d %-5p [%t] %C{2} - %m\n"/>
           </layout>
 </appender>
 
 <appender name="MAIL" class="org.apache.log4j.net.SMTPAppender">
      <param name="SMTPHost" value="your.server" />
      <param name="Subject" value="your subject" />
      <param name="To" value="your.address@domain" />
      <param name="From" value="a.name" />
      <layout class="org.apache.log4j.PatternLayout">
           <param name="ConversionPattern" value="%d - %m\n"/>
      </layout>
 </appender>
 
 <category name="C1" >
     <priority value="error" />
     <appender-ref ref="MAIL" />
 </category>
 
 <root>
  <priority value="info" />
  <appender-ref ref="DEFAULT
root>
 
</configuration>
 
 
You initialize log4j with the static method (call once only) :
    Document configDoc......;    // parse the file
    DOMConfigurator.configure(configDoc.getDocumentElement());
-----Message d'origine-----
De : Fameliaris, Athanasios [mailto:[EMAIL PROTECTED]]
Envoyé : mardi 6 février 2001 13:37
À : [EMAIL PROTECTED]
Objet : SMTPAppender

Is there any example of configuring SMTPappender using configuraion file?

Athanassios K. Fameliaris
Senior S/W Engineer

?       DECISION SYSTEMS INTEGRATION S.A.,
        Pantou  27,
        Athens, 176-71,
        Greece.
(       Office: +30 (0)1   9299562
        Fax:    +30 (0)1   9299550
/       EMail:  [EMAIL PROTECTED]


Reply via email to