GlassFish Operations: Log Notifications
Join the DZone community and get the full member experience.Join For Free
Application Logging vs. System Logging vs. Monitoring
You basically have three options here. Either you choose to integrate some notification magic into your application logging or you go with the system logging or you go with the more classy monitoring approach. However the differences should be clear. By default GlassFish does not provide any third-party logging integration. Whatever logging way you go from a framework perspective you will end up logging application specific events. If you are looking for some kind of application server specific notifications you have to take the system logging or the monitoring road.
http://www.thestarsoftware.com/syslogdaemonlite.html">Star SysLog Daemon Lite and was quite happy with the results.
One last note: If you are stumbling over older Google search results refering to something called "GlassFish Performance Advisor" .. that actually no longer exists. Hasn't been ported to 3.x branch.
In fact, GlassFish doesn't provide a special logging framework integration unlike WebLogic server does. So going this way you will lose the core GlassFish system logs and you can only focus on application specific logging.And that is where the integration actually happens. On an application level. Almost any recent frameworks (Log4J, LogBack) have a couple of providers for you to use out of the box. In terms of notifications email is still the simplest way to go. For that you have to look for the right appender (SMTP). Both LogBack (SMTPAppender) and Log4j (SMTPAppender) offer something here. Configuration is straight forward and only requires you to input some stuff about your SMTP infrastructure. Don't forget to set the right level of logging here. You are definitely not willing to have all DEBUG level messages send to your inbox.
Still thinking about the syslog thing? Both Log4j and LogBack can produce syslog messages with their SyslogAppenders (log4j, logback). But all the above mentioned drawbacks also apply here. On top of that you will not be able to receive the GlassFish core log messsages with your syslog server. There might be very rare and special situations where this would be of any help.
One last thing to mention is the monitoring approach. A couple of monitoring suites can actually read your logfiles (keyword: logfile adapters) and you can configure your logging solution to react to certain pattern. While I don't consider that elegant it might be a stable solution to work with and I have seen this a lot in the wild. Another approach could be to use JMX or even the GlassFish admin REST interface to find out about the relevant metrics. But both don't provide access to the logging subsystem.