As the program can discover issues itself, you could use the facilites available with a modern logging framework. You code against the slf4j API and use a logging backend configured to handle e.g. error messages special.
You then just have to have such a snippet in your code:
} catch (Exception e) {
log.error("FooBar processing failed", e);
}
This generic approach at compile time can then do one or more of the following at runtime:
- Log to a special file.
- Send a Syslog message to another machine
- Send an email to a predefined recipient with the error message and the stack trace.
- Send an instant message to a Jabber account (which can then be forwarded to a MSN or a Yahoo account)
- Write a row in a database
or you can write your own code doing what you need to have done.