views:

47

answers:

1

In my Quartz.NET based application, I have a JobListener that audits all jobs executed to an audit table. However, I also want a listener to detect whenever any sort of error occurs, so I can catch this and email an email address that there is an error, and maybe find the specific error (i.e. my program moves files around, so an error could be a path doesn't exist).

How do I listen for failed jobs, and also is it possible to detect whether there is a huge number of errors, and in that case only send a few emails rather than an email for every single error?

Many thanks

A: 

To detect whenever any sort of error occurs you will want to implement a listener, either a Job listener or a Trigger listener, or probably you'll want both: http://quartznet.sourceforge.net/tutorial/lesson_7.html

You can attach the listeners by calling methods on the IScheduler object you create.

What we do to roll-up multiple emails is use a logging system, specifically NLog. We use a BufferingWrapper around a Mail target so that the error log is sent after some specified number of events has been logged (e.g., 200) or after a specified timeout period has elapsed after the last logged error (e.g., 2 minutes).

qstarin