Bookmark Topic Watch Topic
  • New Topic

log4j SMTP Appender  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi All,

I have already implement log4j for log on console(ConsoleAppender) and also in a separate file(RollingFileAppender) its running fine.

Now I want that if any info or fatal occurred then log4j fire a mail to a particular mail id.

I am trying this by using SMTP appender as:

<appender name="EMAIL" class="org.apache.log4j.net.SMTPAppender">
<param name="BufferSize" value="512" />
<param name="SMTPHost" value="mail.test.com" />
<param name="From" value="ravir@test.com" />
<param name="To" value="ravir@test.com" />
<param name="Subject" value="[SMTPAppender] Application message" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[%d{ISO8601}]%n%n%-5p%n%n%c%n%n%m%n%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="INFO"/>
<param name="LevelMax" value="FATAL"/>
</filter>
</appender>


But its not working.

i think i have to mention username and password in xml file but when i mention username and password as:
<param name="username" value="user" />
<param name="password" value="123" />

then on the console i get message that parameter name username and password is not a valid parameter.

Any body have idea about log4j SMTP Appender ..
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Report post to moderator
Why are you reposting this thread?

Check http://www.coderanch.com/forums/
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!