log4j SMTP appender w/ Gmail = no email :(
creatureoflegend Aug 24, 2011 2:49 PMHi, All!
I've been googling this for 2 days now and can't find an answer. What I want to do is have jboss email me error and fatal log messages. The message is logging to the console and the log file, but I am not recieving any email. Nor can I find a log4j stacktrace that I would expect if there's an error in log4j when it tries to email me. Here's what I did:
Edited the jboss-4.2.3.GA\server\default\conf\jboss-log4j.xml
Uncommented and modified the following pieces:
[code]
<!-- EMail events to an administrator -->
<appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Threshold" value="ERROR"/>
<param name="To" value="myEmail@domain.com"/>
<param name="From" value="theEmailFrom@gmail.com"/>
<param name="Subject" value="JBoss Sever Errors"/>
<param name="SMTPHost" value="smtp.gmail.com"/>
<param name="SMTPUsername" value="theEmailFrom@gmail.com" />
<param name="SMTPPassword" value="theGmailPassword" />
<param name="BufferSize" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="ERROR"/>
<param name="LevelMax" value="FATAL"/>
</filter>
</appender>
...
<root>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
<appender-ref ref="SMTP"/>
</root>
[/code]
java code in my webapp:
[code]
org.jboss.logging.Logger jbossLogger = org.jboss.logging.Logger.getLogger(this.getClass());
jbossLogger.fatal(myMessage.toString());
[/code]
my version of jboss is jboss-4.2.3.GA (I know it's old, but we can't upgrade right now)
java: jdk1.6.0_26
OS: Windows XP Professional
Also, I did check the spam folder of the email I'm tryong to send the message to, nothing there either.
Can anyone see what I'm doing wrong? Also is there a special place to look for the log4j error messages or is it just console and server.log?
Thank you so much!