1 Reply Latest reply on May 27, 2009 9:01 AM by Andy Taylor

    JBM 2 and logging

    Andy Taylor Master

      Ive been looking at removing log4j as a dependency for the user and i have come unstuck.
      I'll explain how our logging currently works so everyone understands the problem

      All JBM classes use JUL as their logger. When running within the AS this is fine as the AS takes care of redirecting these log calls through the jboss logger which uses log4j by default.

      When we run standalone we depend on the Microcontainer and its dependencies. These dependencies use jboss logging which redirects its logging to what ever logging plugin class is set. If this is the null plugin class then the MC (or one of its dependencies) sets a plugin that redirects to system.out which is horrible. Because of this we provide our own plugin class JBMLoggerPlugin which currently uses log4j.

      So any logging by the MC currently does this

      jboss logging -> JBMLoggerPlugin -> log4j

      and any JUL logging (JBM) either does

      JUL -> jboss logging -> JBMLoggerPlugin -> log4j

      if the jboss JUL handler is set or

      JUL -> log4j

      if the log4j handler is set.

      Hope that makes sens, anyway, this means that our clients and server always have a dependency on log4j.

      Changing the JBMLoggerPlugin to log somewhere else would solve this but it can't be JUL as you would end up with

      JUL -> jboss logging -> JBMLoggerPlugin -> JUL -> etc etc

      maybe we could leave the standalone server as is and provide something else for the client, maybe no handlers and just JUL, wdyt?

        • 1. Re: JBM 2 and logging
          Andy Taylor Master

          Ive made some changes to the logging infrastructure to remove the log4j deoendency, the only thing we need it for is to compile the 'Log4jLoggerHandler', This how it works.

          Ive changed the JBMLoggerPlugin to redirect to JUL, this now means that the MC now uses this instead of log4j.

          Ive added a JUL Formatter so the logging looks something like what we would expect and ive added/updated logging.properties file to use this and also a filehandler. We can tweak the formatter as we need or make it more configurable.