3 Replies Latest reply on Dec 1, 2011 8:42 AM by Pasqualino Imbemba

    Application-specific logging in JBoss AS 6 (yet again)

    Joshua Davis Expert

      JBoss AS 6.0.0.Final and app-specific logging -  I've tried putting jboss-logging.xml in the META-INF directory of an EAR deployment as this post suggests.   When JBoss starts it does seem to be reading the file, but the file is always empty.  When I use a JBoss Logging 'Logger', the output shows up in 'server.log', configured in deploy/jboss-logging.xml but never in the application specific log file.   I've tried using the JBoss Logging API directly, but it's as if the application-specific logging configuration is pretty much ignored except initially creating the log file.


      Do I have to do something with the class loaders or something?


      Here's the jboss-logging file:


      <?xml version="1.0" encoding="UTF-8"?>
       <!-- My application jboss-logging.xml -->
       <logging xmlns="urn:jboss:logging:6.0" context="MyApplication">
            ~ This element, in conjunction with the "context" attribute above, tells the
            ~ logging system that I want my own separate logging environment.
          <define-context name="MyApplication"/>
          <!-- A time/date based rolling handler -->
                suffix=".yyyy-MM-dd">  <!-- To roll over at the top of each hour, use ".yyyy-MM-dd-HH" instead -->
                <!-- To revert back to simple stack traces without JAR versions, change "%E" to "%e" below. -->
                <!-- Uncomment this to get the class name in the log as well as the category
                <pattern-formatter pattern="%d %-5p [%c] %C{1} (%t) %s%E%n"/>
                <!-- Uncomment this to log without the class name in the log -->
                <pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
         <!-- Configure the root logger with my handler from above -->
              <level name="DEBUG"/>
                  <handler-ref name="FILE"/>


      I can switch over to Log4J, but I want to make sure I'm not missing something obvious before I do that.