1 Reply Latest reply on Jul 22, 2012 11:14 PM by jamezp

    How to change logging framework in AS7?

    metal.carratt

      Hi,

       

      We are trying to set up logging for our application using Logback.  We were originally trying to do this by using slf4j to route all the logs to Logback.  However JBoss seems to have its own version of slf4j to route logging to JBoss logging (which we believe uses java.util.logging?).  We were previously able to avoid this by disabling the jboss slf4j (in a jboss-deployment-structure.xml file we added an exclusion for modules org.slf4j and org.slf4j.impl), which was working.  However one of our application dependencies uses java.util.logging.  To enable java.util.logging to be routed to slf4j (and thus Logback) we would normally use jul-to-slf4j.  However JBoss has a jul-to-slf4j stub to prevent us doing this.  This makes it impossible for us to route java.util.logging to slf4j and from there to Logback.

       

      The reason we want to use Logback is because we want the following functionality:

      1. We want to be able to log to syslog.
      2. We want to be able to configure the format of the log statements.
      3. We want to be able to log different Handlers to different files, i.e., some to a performance measurement log, others to an application event log.
      4. We want to be able to configure logging settings while the application is running and without having to restart the application.

       

      Our first question then is, is it possible for us to use Logback for all logging statements in our application (whether through the original slf4j or through the JBoss version somehow)?

       

      Our second question is, if it is not possible to use Logback for logging, is it possible for the JBoss logger to do the items numbered above? (And if so, could someone point us to some documentation detailing how it could be done?)

       

      Thanks.

        • 1. Re: How to change logging framework in AS7?
          jamezp


          Our first question then is, is it possible for us to use Logback for all logging statements in our application (whether through the original slf4j or through the JBoss version somehow)?

          No, the application has to use JBoss Logging with JBoss Log Manager.

           

           

          1. We want to be able to log to syslog.
          2. We want to be able to configure the format of the log statements.
          3. We want to be able to log different Handlers to different files, i.e., some to a performance measurement log, others to an application event log.
          4. We want to be able to configure logging settings while the application is running and without having to restart the application.

          All the above items, with the exception of logging to the syslog, is possible with JBoss AS 7 as is. There is https://github.com/kifj/jboss-syslog for witting to the syslog, but nothing in the JBoss Log Manager.

           

          You can configure the logging with any of the management interfaces; CLI, web interface, etc.

           

          --

          James R. Perkins