2 Replies Latest reply on May 8, 2013 2:05 PM by Christopher Wong

    Diverting HornetQ logging to log4j

    Christopher Wong Newbie

      It used to be possible to get HornetQ to output logging through log4j using something like this:


      org.hornetq.core.logging.Logger.setDelegateFactory(new Log4jLogDelegateFactory());


      Or  calling FileConfiguration.setLogDelegateFactoryClassName()


      Starting with version 2.3.0.Final, this code is no longer valid. How  may I redirect HornetQ logging to log4j? Thanks.



        • 1. Re: Diverting HornetQ logging to log4j
          Clebert Suconic Master

          We had to move to jboss-logging after 2.3...   can you do some quick check on their docs and feed this thread... if you can't find it we can take a look.

          • 2. Re: Diverting HornetQ logging to log4j
            Christopher Wong Newbie

            Thanks. It turns out it's not easy to find straightforward documentation for jboss-logging. Fortunately, Mr Google had a few things to say. According to the org.jboss.logging.LoggingProviders class, the logging provider selection works as follows:

            • If you set the org.jboss.logging.provider system property to one of "jboss", "jdk", "log4j" or "slf4j", it will use the specified logging provider.
            • Otherwise, if you are running within JBoss AS, HornetQ will use the JBoss logging implementation.
            • Otherwise, it will test for the presence of logging libraries in the following order: log4j, slf4j, JUL. The first library found will be used.

            The HornetQ user manual also gave instructions to set the java.util.logging.manager system property, but those instructions were specifically to enable the JBoss logging provider and so were not so helpful for other logging providers.