• Post Reply Bookmark Topic Watch Topic
  • New Topic

Log4j SMTPAppender Not Sending Mail  RSS feed

 
David McWilliams
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have written a small Java program to try to get log4j + SMTPAppender to log an error and send me an email when my program throws an exception. The exception is being correctly logged but no mail is being sent.

I have tested my program to see if it sends mail and it does - just not via log4j. I am using a log4j.properties file to configure the logging.

Have any of you any ideas why my email is not being sent when I throw an exception? Here is my log4j.properties file:
 
David McWilliams
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's working now. In my code, I was calling


I changed it to:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!