GlassFish Performance Advisor - Log Entry Alert
By sirajg on Feb 09, 2009
The Log Entry Alert sends an email alert whenever there is an entry in the application server's log file for user-specified logger(s) at user specified level. The logger could be one of the predefined application server logger or it could be any logger that your application uses. So this feature can be particularly useful when user applications want to send out email to users or admninistrators, in certain conditions.
For example, consider the case when someone tries to login to your application and the authentication fails for a certain number of times. You may want to be alerted when this happens. Your application could log this in the application server's log file at the WARNING level in a logger of your choice, say com.xyz.mylogger. You can configure the Performance Advisor to send out an email alert when there is a log entry at WARNING level in the logger com.xyz.mylogger. And that's it!
Once you have the Performance advisor setup and running, go to the admin console and click on Management Rules->LogEntry Alert. This is the Log Entry Alert configuration screen that you will see :
In the above screen you specify the log level and the logger name for which you want to be alerted. You could specify multiple loggers, separating them by commas. For example, if you want to be alerted when a WARNING level entry takes place for loggers com.xyz.logger1 and com.xyz.logger2, you specify "com.xyz.logger1,com.xys.logger2" in the logger names field. If you want to be alerted for all loggers just enter "\*".
Besides that, you need to specify the email address of the recipient and other email settings. You can either use the JavaMail Resource or specify other email values to get the email going. At the bottom of the screen, you can specify the targets for which you want to set up this alert.