logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rusty Wright <rusty+comm...@grunt.berkeley.edu>
Subject SMTPAppender help needed
Date Thu, 14 Jul 2005 17:44:01 GMT
I'm trying to use SMTPAppender but it's not sending me the email.  I 
figured out that I need to add Sun's jaf.jar and activation.jar, so now 
it runs without any error.

This is a standalone program that's packaged as a jar file.  My smtp 
server is postfix.  The CONS and FILE appenders are working.  The 
program is using Commons net to do an ftp file upload.

I'm running it with the command

   /usr/java/bin/java -Dlog4j.debug -jar /usr/local/cars/bin/cars.jar

Following the config file is the debug output.

Thanks.

Here's my log4j.xml config file:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
     <appender name="CONS" class="org.apache.log4j.ConsoleAppender">
         <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%M %m%n" />
         </layout>
     </appender>

     <!-- param entries must come before layout entry!?          -->
     <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
         <param name="File" value="/var/tmp/cars.log" />
         <param name="MaxFileSize" value="300kb" />
         <param name="MaxBackupIndex" value="9" />
         <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%p: %d [%C %M] %m%n" />
         </layout>
     </appender>

     <!-- param entries must come before layout entry!?          -->
     <appender name="MAIL" class="org.apache.log4j.net.SMTPAppender">
         <param name="SMTPHost" value="localhost" />
         <param name="From" value="CARS-Uploader" />
         <param name="To" value="rusty" />
         <param name="Subject" value="CARS upload mail log" />
         <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%p: %d [%C %M] %m%n" />
         </layout>
     </appender>

     <!-- example of how to change the level and appender        -->
     <!-- for a specific class.                                  -->
     <logger name="props.PropsBase">
         <level value="warn" />
         <appender-ref ref="FILE" />
     </logger>

     <root>
         <level value="debug" />
         <appender-ref ref="CONS" />
         <appender-ref ref="FILE" />
         <appender-ref ref="MAIL" />
     </root>
</log4j:configuration>

Here's the output:

log4j: Trying to find [properties/log4j.xml] using context classloader 
sun.misc.Launcher$AppClassLoader@133056f.
log4j: Trying to find [log4j.xml] using context classloader 
sun.misc.Launcher$AppClassLoader@133056f.
log4j: Trying to find [log4j.xml] using 
sun.misc.Launcher$AppClassLoader@133056f class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader 
sun.misc.Launcher$AppClassLoader@133056f.
log4j: Trying to find [log4j.properties] using 
sun.misc.Launcher$AppClassLoader@133056f class loader.
log4j: Trying to find [log4j.properties] using 
ClassLoader.getSystemResource().
log4j: Could not find resource: [null].
log4j: System property is :null
log4j: Standard DocumentBuilderFactory search succeded.
log4j: DocumentBuilderFactory is: 
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
log4j: debug attribute= "null".
log4j: Ignoring debug attribute.
log4j: Threshold ="null".
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [props.PropsBase] additivity to [true].
log4j: Level value for props.PropsBase is  [warn].
log4j: props.PropsBase level set to WARN
log4j: Class name: [org.apache.log4j.RollingFileAppender]
log4j: Setting property [file] to [/var/tmp/cars.log].
log4j: Setting property [maxFileSize] to [300kb].
log4j: Setting property [maxBackupIndex] to [9].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [%p: %d [%C %M] %m%n].
log4j: setFile called: /var/tmp/cars.log, true
log4j: setFile ended
log4j: Adding appender named [FILE] to category [props.PropsBase].
log4j: Level value for root is  [debug].
log4j: root level set to DEBUG
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [%M %m%n].
log4j: Adding appender named [CONS] to category [root].
log4j: Adding appender named [FILE] to category [root].
log4j: Class name: [org.apache.log4j.net.SMTPAppender]
log4j: Setting property [SMTPHost] to [localhost].
log4j: Setting property [from] to [CARS-Uploader].
log4j: Setting property [to] to [rusty].
log4j: Setting property [subject] to [CARS upload mail log].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [%p: %d [%C %M] %m%n].
log4j: Adding appender named [MAIL] to category [root].
main start getting entries from db
main finished getting entries from db
main uploadName: 'rbs.q.carcyin.d050713.test1'
connect 220-FTPD1 IBM FTP CS V1R4 at ironwood.Berkeley.EDU, 23:36:07 on 
2005-07-13.
connect 220 Connection will close if idle for more than 5 minutes.
connect 230 WSS0RCW is logged on.  Working directory is "WSS0RCW.".
sendCarsData 200 Representation type is Ascii NonPrint
sendCarsData 200 SITE command was accepted
sendCarsData 125 Storing data set RBS.Q.CARCYIN.D050713.TEST1
sendCarsData sending file 'rbs.q.carcyin.d050713.test1'
sendCarsData sent 1419 lines
sendCarsData 125 Storing data set RBS.Q.CARCYIN.D050713.TEST1
disconnect logout
disconnect disconnect

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


Mime
View raw message