users@glassfish.java.net

Re: Instance name in Log Handler?

From: <glassfish_at_javadesktop.org>
Date: Mon, 20 Jul 2009 05:32:26 PDT

Thank you for your reply, I realize I was unnecessarily unclear, I'll tryo to explain a little bit better, or at least ask for more clarifications.

I don't see a problem with implementing the actual log handler, it is just a minimal implementation of the Handler.publish() interface that reads a few values from LogRecord and sends it to a central location, so I have no need for SLF4J for this that I can see. Good tip for the future, though.

What I am asking for is a way to determine which instance that generated the log message, from within the Handler class, since they will be written to a central location. A very likely scenario is simply piping all the logs directly to a database via JDBC, but for that data to be useful, we need to be able to filter on certain instances/servers afterwards. Yes, it would be quite possible to harvest all the regular log files or something similar instead, but if there is a way to read the instance name we feel this would be a much easier way to go for our setup.

I'm not familiar with jps and jinfo, but either way they are not present on our Solaris servers and I'm also quite uncertain I want to rely on external processes for this... but if I am missing something here, please elaborate, I may be misunderstanding (I often am).

Since I am in a class that is loaded by Glassfish, is there no easier way to get this information via some kind of internal API in Glassfish, or even to read these system properties with regular Java?

That's the only thing I (think I) really need, a way to get information about the containing instance when inside the custom log handler.

I've been googling a lot on Glassfish and Log handlers and more, but ino luck - and I didn't find anything in the Glassfish docs either, about this, but I'm not familiar at all with these things so it's likely I just ask the wrong questions. :)

Thanks again!
[Message sent by forum member 'klunden' (klunden)]

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