users@glassfish.java.net

Cusom Log Handler causes duplicated output

From: <glassfish_at_javadesktop.org>
Date: Fri, 22 Jun 2007 09:21:48 PDT

Hi: I'm developing a custom handler to be loaded on Glassfish and I have a problem. The handler is used to broadcast the log records to remote clients connected through a TCP socket. The handler works fine in standalone applications.

After creating the log handler and configuring the server to use it, a strange behavior occurs: The "publish" method defined in the Handler interface and implemented in my class is called several times (between 2 and 4 times), therefore my handler process the same LogRecord at least two times. I also have noticed that when a component prints a message to the standard output, my log handler receives the message four times.

Is this a Glassfish weird behavior? anyone knows a workaround? Seems to me that the handler is registered several times. I check the number of times that the handler is created and the constructor is called only one time.

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

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