What is the best way to inform administrators about new exceptions to Java applications?
My question is what is the best way to track exceptions from application administrators (for maintenance purposes, notify the administrator of the exception thrown)
For users of the system, I believe that exceptions should be caught and corresponding error messages should be displayed For the system administrator, I think the best way is to let the message system send the details of each exception to the receiver as a message Once the receiver receives the new error message, it still exists in the database, or sends an email containing exceptions to the administrator
try{ .... } catch(Exception e){ //what to do here? how to notify admin? }
Solution
I suggest using log4j to configure an SMTP appender to listen for fatal logs Then, just log a fatal level message (containing any useful information you can get) and any unhandled exceptions arrive at your global try / catch block
See: what is the proper way to configure smtpappender in log4j?