users@glassfish.java.net

Any way to configure email notifications for logging events in GF?

From: <glassfish_at_javadesktop.org>
Date: Fri, 31 Aug 2007 11:24:26 PDT

Basically, is there any way to configure GF to send an email if, say, a SEVERE shows up in the log file?

In theory, I could simply add a ROOT level handler, hopefully via the JDK Logging config file.

But how would I configure the mail session? The handler could be called almost any time, but notably it could be called from almost any application.

[code]
Context ctx = new InitialContext();
Session session = (Session) initial.lookup("java:comp/env/mail/LogMailSession");
[/code]

This should work pretty much anywhere in the server, once it's up, correct?

Because a log Handler will be running within the context of whatever is calling the logger, whether it's a Session Bean, and MDB, a EJB Timer, Servlet, Servlet Listener, etc.

But the Handler will be loaded from a pretty high level class loader (if it's configured by the core logger via the config file), so...hmm...yuk... Classpath fun there I think.

We still don't have an "easy" way to tie in to App server lifecycle events. I could always add the Handler myself from a servlet init method, but that assumes a global Logger (which happens to be true now, but long term that most probably won't be the case).

Any hints on doing this right?
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=233505