Get notified of software errors by email

I recently set up an application at a customer’s site. To get notified of errors, I used log4j’s SMTPAppender to sent an email with the log message if the log level was ERROR. I watched my Mailbox for about a week, but then I noticed the incredible number of over 10.500 new messages in my inbox.

What had happened?

My application’s job is to parse emails sent to a certain mailbox and process them. Unfortunately the application would leave a message in the inbox of an error occured during import. Because the other system sent an email that my application would reject to parse, the message stayed in the inbox and my application tried to parse it again and again, every 15 minutes.

What do we learn?
  1. Do not use an active notification on error if the error is permanent.
  2. Do not report the same error again and again.
  3. Write some log4j appender that would filter or aggregate the messages in this case. ;-)

{ Comments are closed! }