2 Replies Latest reply on Aug 31, 2006 3:02 AM by Richard Barnett

    Custom java.util.logging Handlers & Appenders

    Richard Barnett Newbie

      I'm trying to use some custom java.util.logging (JUL) Handlers & Appenders in a JBoss web-app. (3.2.7RC1, on Win2k.)

      JUL can't load these classes: I get a ClassNotFoundException for the Handler, & the Appender silently fails. Top of the stack trace:

      java.lang.ClassNotFoundException: com.bullant.enterprise.log.SMTPAppender
       at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at java.util.logging.LogManager$5.run(LogManager.java:778)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:771)

      The JUL documentation says: "Note that all classes loaded during LogManager configuration must be on the system class path. That includes the LogManager class, any config classes, and any handler classes."

      I've tried the following locations for the jars implementing these classes:
      * the war's WEB-INF/lib
      * the server lib dir JBOSS_DIST/server/.../lib
      * JBOSS_DIST/lib

      I tried adding these jars to JBOSS_CLASSPATH inside run.sh/run.bat.
      Based on info from this site I added them to the JBOSS_DIST/lib & passed -L jarname on the command line.

      All these approaches have failed. How do I set things up so that JUL can load my classes?

      (Ironically, the custom JUL Handler is an adapter to a log4j Appender...)


      -- Richard