0 Replies Latest reply on Oct 21, 2004 1:06 PM by thomas lehmann

    commons-logging inside JBoss4.0

    thomas lehmann Newbie

      Hi all,

      does anybody has an idea how to build a logger that implements org.apache.commons.logging.Log and that works properly inside JBoss4.0? My first guess was to create a DelegatingLogger which gets a reference to an org.jboss.logging.Logger and which delegates all logging requests to this logger. For example:

      public class DelegatingLogger implements Log {
      
      // the JBoss logger this logger should delegate all request to
      private Logger _delegate;
      
      ...
      
      public void trace(Object msg) {
      
       if (_delegate.isTraceEnabled() && msg != null)
       _delegate.trace(msg);
      }
      
      ...
      }
      


      First everything seems to work fine. But when I tried to resolve the location where the logging event was triggert, always the DelegatingLogger was detected. Scanning the source code of org.jboss.logging.Logger and org.jboss.logging.Log4jLoggerPlugin I realised that there seems to be no solution for my problem, since the JBoss-logger is hard-coded as triggering logger in the Log4jLoggerPlugin.
      Am I completly wrong with my approach? Does someone has a better idea how to use commons-logging whithin JBoss.

      Thanks,
      Thomas