logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas E Wegscheid <Douglas_E_Wegsch...@whirlpool.com>
Subject Re: Problem in using SMTPAppender with gmail
Date Fri, 19 Sep 2008 12:28:05 GMT
I believe that SMTP to gmail needs to be done with TLS (encrypted). A 
google search will turn up what needs to be done to make javamail talk 
TLS; unsure of how to configure log4j to configure javamail to do so.

http://forums.sun.com/thread.jspa?threadID=5304862&messageID=10293973 
describes the same problem, but no solution. It does reference using a 
log4j.appender.mail.smtp.starttls.enable property.

but that should get you started in your research!

Douglas E Wegscheid
Lead Technical Analyst, Whirlpool Corporation
(269)-923-5278

"A wrong note played hesitatingly is a wrong note. A wrong note played 
with conviction is interpretation."



"Virajith KHP" <khp.virajith@gmail.com> wrote on 09/19/2008 07:30:59 AM:

>  Hello,
> 
> I'm using Log4j as the logging framework and I've configured it to send 
an
> email with log information when a log with ERROR/FATAL logging level is
> created.My Log4j configuration is as follows.
> 
> 
>     code:
> 
> 
>      <appender  name="smtp_ErrorFatal"
> class="org.apache.log4j.net.SMTPAppender" >
>             <param name="SMTPHost" value="smtp.gmail.com" />
>             <param name="SMTPUsername" value="[username]" />
>             <param name="SMTPPassword" value="[password]" />
>             <param name="From" value="[valid email]" />
>             <param name="To" value="[valid email]" />
>             <param name="Cc" value="[valid email]" />
>             <param name="Subject" value="[LOG] ..." />
>             <param name="BufferSize" value="512" />
>             <param name="threshold" value="error" />
>             <layout class="org.apache.log4j.PatternLayout">
>                 <param name="ConversionPattern" value="%d{DATE} | %-5p |
> %X{userid} | %C | %M | %t | %L | %m%n" />
>             </layout>
>         </appender>
> 
> 
> 
> But whenever a log with ERROR/FATAL logging level is created, Log4j 
tries to
> send the email but terminates it with the following exception..
> 
>     code:
> 
> 
>     log4j:ERROR Error occured while sending e-mail notification.
>     com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a
> STARTTLS command first. a14sm1453665tia.0
> 
>             at
> 
com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
>             at
> com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
>             at
> com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
>             at javax.mail.Transport.send0(Transport.java:169)
>             at javax.mail.Transport.send(Transport.java:98)
>             at
> org.apache.log4j.net.SMTPAppender.sendBuffer(SMTPAppender.java:330)
>             at
> org.apache.log4j.net.SMTPAppender.append(SMTPAppender.java:215)
>             at
> org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
>             at
> org.apache.log4j.helpers.AppenderAttachableImpl.
> appendLoopOnAppenders(AppenderAttachableImpl.java:66)
>             at 
org.apache.log4j.Category.callAppenders(Category.java:206)
>             at org.apache.log4j.Category.forcedLog(Category.java:391)
>             at org.apache.log4j.Category.error(Category.java:305)
>             at
> miracle.server.presentation.customcomponents.SplashFrame.
> retrieveSplashImage(SplashFrame.java:53)
>             at
> miracle.server.presentation.customcomponents.SplashFrame.
> <init>(SplashFrame.java:29)
>             at
> miracle.server.logic.common.AppManager$1.run(AppManager.java:41)
>             at java.awt.event.InvocationEvent.dispatch(Unknown Source)
>             at java.awt.EventQueue.dispatchEvent(Unknown Source)
>             at 
java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
> Source)
>             at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown
> Source)
>             at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
> Source)
>             at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>             at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>             at java.awt.EventDispatchThread.run(Unknown Source)
> 
> 
> 
> Can anybody point out where the problem is?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message