users@glassfish.java.net

glassfish logging / JDBC Log Handler

From: <glassfish_at_javadesktop.org>
Date: Tue, 14 Apr 2009 06:47:58 PDT

I have created my own java.util.logging.Handler
     put the jar in <glassfish>/domains/domain1/lib
     then, admin console -> App Server -> Logging (Glassfish Version 2.1)
           and set custom handler to my new Handler class above
     restarted glassfish.

Everything is ok here...I can see that my new handler is picking up the log messages
in addition to the default logging done to server.log

Now, what I really want to do is to insert this information to a database...
In the above scenario, I am guessing that I cannot use InitialContext or other EJB resources
to get the jdbc connection pool since the logging process is initiated too early in the glassfish startup process??? Does anyone have an example of how to achieve this?

My next attempt will be to put the LogHandler in my ear package and then do
something (kludgy) like Logger.addHandler(myNewHandler)...I would rather be able
to do this in the above way...

Can anyone provide me with example or instructions? or even better, is there a package
of java..util.logging implementations which would accomplish this (I know that log4j has jdbcAppender...)

Thanks.
Sue
[Message sent by forum member 'suedonne123' (suedonne123)]

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