logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Massimo Quagliani" <massimo.quagli...@ericsson.com>
Subject RE: SMTPAppender
Date Thu, 04 Dec 2008 10:09:01 GMT
Thanks,

But I changed my log4j.properties file using another SMTP host, 
which, according to this link 
http://www.velociraptus.com/internet/articoli_d.php?particoloID=27
uses port 25 for SMTP (it is in italian but in the table it is clear the port is 25).
The error is still there...
Please help!!

/Massimo


# Email appender
log4j.appender.email=org.apache.log4j.net.SMTPAppender
log4j.appender.email.BufferSize=25
log4j.appender.email.SMTPHost=mail.libero.it
log4j.appender.email.SMTPUsername=<valid_username>
log4j.appender.email.SMTPPassword=<valid_password>
log4j.appender.email.From=xxxx@libero.it
log4j.appender.email.To=xxxx@libero.it
log4j.appender.email.Subject=Error
log4j.appender.email.layout=org.apache.log4j.PatternLayout
log4j.appender.email.layout.ConversionPattern=    %d{DATE} %-5p %m - %c{3} [%t] [%r ms]%n%n
log4j.appender.email.threshold=ERROR


The stack trace is the same...

2008-12-04 09:28:17,515 ERROR [http-8080-2]                : This is a try!
log4j:ERROR Error occured while sending e-mail notification.
javax.mail.MessagingException: Could not connect to SMTP host: mail.libero.it, port: 25;
  nested exception is:
	java.net.ConnectException: Connection timed out: connect
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
	at javax.mail.Service.connect(Service.java:310)
	at javax.mail.Service.connect(Service.java:169)
	at javax.mail.Service.connect(Service.java:118)
	at javax.mail.Transport.send0(Transport.java:188)
	at javax.mail.Transport.send(Transport.java:118)
	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 servlet.Log4jServlet.doGet(Log4jServlet.java:80)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection timed out: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)
	... 28 more


-----Original Message-----
From: Joe White [mailto:jwhite@asidejob.com] 
Sent: mercoledì 3 dicembre 2008 20.26
To: log4j-user@logging.apache.org
Subject: Re: SMTPAppender



   Gmail SMTP server requires TLS and it does not use the default port of 25.

   According to this link:

   http://mail.google.com/support/bin/answer.py?hl=en&answer=13287

   You must use port 456 or 587 for SMTP.

   However, port is not an option YET in the latest release. (unless
1.2.16 has been release)

   Here is what Curt replied with.

   "

   log4j.appender.YOURAPPENDERNAME.smtpUsername=USERNAME
log4j.appender.YOURAPPENDERNAME.smtpPassword=PASSWORD
log4j.appender.YOURAPPENDERNAME.smtpPort=PORT

Port is in the current source, but not in the last release.  We need to cut a log4j
1.2.16 soon.

   "

   Quoting Massimo Quagliani <massimo.quagliani@ericsson.com>:

>> Hi,
>> I have the following problem using SMTPAppender, Actually the email 
>> does not arrive to the mailbox and I got the following error:
>>
>> log4j:ERROR Error occured while sending e-mail notification.
>> javax.mail.MessagingException: Could not connect to SMTP host:
>> smtp.gmail.com, port: 25;
>>    nested exception is:
>>         java.net.ConnectException: Connection timed out: connect
>>
>> The log4j.properties contains:
>>
>> log4j.rootCategory=info, dest1, dest3, email
>>
>> # Email appender
>> log4j.appender.email=org.apache.log4j.net.SMTPAppender
>> log4j.appender.email.BufferSize=25
>> log4j.appender.email.SMTPHost=smtp.gmail.com
>> log4j.appender.email.SMTPUsername=<valid_username>
>> log4j.appender.email.SMTPPassword=<valid_password>
>> log4j.appender.email.From=xxxx@gmail.com
>> log4j.appender.email.To=xxxx@gmail.com
>> log4j.appender.email.Subject=Error
>> log4j.appender.email.layout=org.apache.log4j.PatternLayout
>> log4j.appender.email.layout.ConversionPattern=    %d{DATE} %-5p %m - 
>> %c{3} [%t] [%r ms]%n%n log4j.appender.email.threshold=ERROR
>>
>>
>> I am using eclipse on my PC for this try.
>> Please could you help me to find the solution to this nasty problem?
>> Thanks in advance, below is the complete stack trace
>>
>>
>> 2008-12-03 18:23:38,296 ERROR [http-8080-1]                : This is 
>> a try!
>> log4j:ERROR Error occured while sending e-mail notification.
>> javax.mail.MessagingException: Could not connect to SMTP host:
>> smtp.gmail.com, port: 25;
>>    nested exception is:
>>         java.net.ConnectException: Connection timed out: connect
>>         at
>> com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
>>         at
>> com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:41
>> 2
>> )
>>         at javax.mail.Service.connect(Service.java:310)
>>         at javax.mail.Service.connect(Service.java:169)
>>         at javax.mail.Service.connect(Service.java:118)
>>         at javax.mail.Transport.send0(Transport.java:188)
>>         at javax.mail.Transport.send(Transport.java:118)
>>         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 servlet.Log4jServlet.doGet(Log4jServlet.java:80)
>>         at 
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>         at 
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
>> i
>> cationFilterChain.java:290)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
>> i
>> lterChain.java:206)
>>         at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
>> a
>> lve.java:233)
>>         at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
>> a
>> lve.java:175)
>>         at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
>> a
>> va:128)
>>         at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
>> a
>> va:102)
>>         at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
>> v
>> e.java:109)
>>         at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
>> a
>> :286)
>>         at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
>> 844)
>>         at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
>> s
>> s(Http11Protocol.java:583)
>>         at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
>> 7
>> )
>>         at java.lang.Thread.run(Unknown Source) Caused by: 
>> java.net.ConnectException: Connection timed out: connect
>>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>>         at java.net.PlainSocketImpl.doConnect(Unknown Source)
>>         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>>         at java.net.PlainSocketImpl.connect(Unknown Source)
>>         at java.net.SocksSocketImpl.connect(Unknown Source)
>>         at java.net.Socket.connect(Unknown Source)
>>         at java.net.Socket.connect(Unknown Source)
>>         at
>> com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
>>         at
>> com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
>>         at
>> com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)
>>         ... 28 more
>

   --
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
Aristotle

---------------------------------------------------------------------
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