5 Replies Latest reply on Dec 11, 2009 4:54 AM by timfox

    Configuring HornetQ standalone server logging

      This msg is just FYI with examples you can use!

      First of all read the brief info here: http://hornetq.sourceforge.net/docs/hornetq-2.0.0.BETA5/user-manual/en/html/logging.html

      I used to work with log4j and it took me some times to get JUL (java.util.logging) working. HornetQ logging configured. By default HornetQ is using JUL, and it's level are different from Log4j. So if you want to see more server details for example, you would need to add a file to HORNETQ_HOME/config/logging.properties like this:

      handlers = java.util.logging.ConsoleHandler
      java.util.logging.ConsoleHandler.level=ALL
      java.util.logging.ConsoleHandler.formatter=org.hornetq.integration.logging.HornetQLoggerFormatter
      .level=SEVERE
      org.hornetq.level=CONFIG
      org.hornetq.core.management.level=FINE
      


      * Note you need ".level" for each category!

      And the levels are (don't use Log4j level name!!!)

      SEVERE (highest value)
      WARNING
      INFO
      CONFIG
      FINE
      FINER
      FINEST (lowest value)
      


      Restart your HornetQ server now and you should nee more messages.


      But if you want to use log4j instead, the HornetQ document didn't mention that you have to set one more line in order to see anything below INFO. This is how, in your HORNETQ_HOME/config/logging.properties file, type this:

      handlers=org.hornetq.integration.logging.Log4jLoggerHandler
      .level=ALL
      


      Then you need to edit HORNETQ_HOME/bin/run.bat(sh) to include log4j config file. Like this on run.bat after the set JVM_ARGS line:
      set SCRIPT_DIR=%~dp0
      set JVM_ARGS=%JVM_ARGS% -Dlog4j.configuration=file:///%SCRIPT_DIR%%CONFIG_DIR%\log4j.properties
      


      Then you can add log4j.properties file into HORNETQ_HOME/config/stand-alone/non-clustered dir:
      log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
      log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
      log4j.appender.STDOUT.layout.ConversionPattern=%05p | - %m%n
      log4j.rootCategory=WARN, STDOUT
      log4j.category.org.hornetq=INFO
      log4j.category.org.hornetq.core.management=DEBUG
      


      The Log4j Levels are:


      FATAL (highest value)
      ERROR
      WARN
      INFO
      DEBUG
      TRACE (lowest value)
      


      I hope these are helpful to you.

      -Z