1 Reply Latest reply on Jul 8, 2002 9:58 AM by Daniel Cohen

    Singleton

    Matt Hollingsworth Newbie

      I'm using java.util.logging to implement logging in my EJBs.

      I want all loggers (one for each class) to write to a single file. To do this, every logger must share a single Handler (an instance of FileHandler).

      So, I've extended the Logger class such that a call to Logger.getLogger() attempts to retrieve a handler from JNDI; if the lookup fails, a new handler is created and bound.

      Obviously this is almost a singleton, but not quite because there's no synchronization.

      Is this solution crap? Any patterns/ideas/comments/anything?