AW: SMTPAppender
Try a standalone tool in order to open this socket. E.g. castalia socktest (free download), or even telnet in your command prompt: Telnet host port heri -Ursprüngliche Nachricht- Von: Massimo Quagliani [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 4. Dezember 2008 18:02 An: Log4J Users List Betreff: RE: SMTPAppender Please, could you explain in detail what you would do in this situation? I didn't figure out your suggestion. /Max -Original Message- From: Joe White [mailto:[EMAIL PROTECTED] Sent: giovedì 4 dicembre 2008 17.45 To: log4j-user@logging.apache.org Subject: RE: SMTPAppender The error is clear in the stacktrace. java.net.ConnectException: Connection timed out: connect at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391) I do not think it's log4j related.. Can you make the connection on your box via telnet or some other type of email program ? Quoting Massimo Quagliani [EMAIL PROTECTED]: 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 [EMAIL PROTECTED] [EMAIL PROTECTED] 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
Re: AW: SMTPAppender ignores Threshold value
As Patrick mentioned, the code to implement this is really trivial with getters and setters. The whole point behind trying to have this TriggerLevel is, currently the TriggeringEventEvaluator does nothing other than comparing the logging event level with some threshold (currently ERROR). Users are definitely allowed to configure their own TriggeringEventEvaluator to override the default behaviour. However, i believe (just my personal opinion), instead of asking users to *specify a class* for overriding the default behaviour it definitely makes sense to ask them to configure the TriggerLevel (or whatever you may want to call that) and let Log4j internally handle the the logic. regards, -Jaikiran - Original Message From: Wyss Patrick [EMAIL PROTECTED] To: Log4J Users List log4j-user@logging.apache.org Sent: Thursday, 5 July, 2007 6:37:47 PM Subject: AW: SMTPAppender ignores Threshold value certainly it is true that the code for your own TriggeringEventEvaluator is trivial. however my personal opinion is that being able to set the triggering level is a requirement which is common enough to be implemented in the SMTPAppender. e.g. setting it to FATAL because you only want to know when your app needs a restart seems quite common to me. however the patch (which i implemented for me when SMTPAppender was not yet able to authenticate) is even more trivial it's 12 lines of code (setter and getter plus *one* line of code that changes in the DefaultEvaluator) so i guess it would be reasonable to include it. best reagrds patrick Reasonable? While you make a good point about the seeming arbitrariness of the default trigger, it really is pretty trivial code. In my case, and I suspect many others, the desirable trigger for sending out recent e-mail logs would be something entirely separate from log level. --Wayne - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/
AW: SMTPAppender ignores Threshold value
certainly it is true that the code for your own TriggeringEventEvaluator is trivial. however my personal opinion is that being able to set the triggering level is a requirement which is common enough to be implemented in the SMTPAppender. e.g. setting it to FATAL because you only want to know when your app needs a restart seems quite common to me. however the patch (which i implemented for me when SMTPAppender was not yet able to authenticate) is even more trivial it's 12 lines of code (setter and getter plus *one* line of code that changes in the DefaultEvaluator) so i guess it would be reasonable to include it. best reagrds patrick Reasonable? While you make a good point about the seeming arbitrariness of the default trigger, it really is pretty trivial code. In my case, and I suspect many others, the desirable trigger for sending out recent e-mail logs would be something entirely separate from log level. --Wayne - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: SMTPAppender ignores Threshold value
I've filed bug 42823 (http://issues.apache.org/bugzilla/show_bug.cgi? id=42823) for this thread and suggest that further discussion take place either in the bug report or on log4j-dev as it has moved beyond just a usage question. The subject line should be changed on any new thread since my understanding is that threshold is not ignored, it just wasn't intended to do what the original poster thought it did. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]