1 Reply Latest reply on Feb 6, 2012 12:01 PM by James Perkins

    Logging of specific category not working in 7.0.2?

    Markus Dahm Novice

      Hi,

       

      I'd like to log security related messages to a specific file with AS 7.0.2.

      Alas, this does not work as expected. As you can see I'm trying to log the category "javax.security" to a file named "server-security.log".

      That file remains empty while security exceptions are still appended to the CONSOLE and FILE loggers.

       

      What's going wrong?

       

      Cheers

         Markus

       

       

      <subsystem xmlns="urn:jboss:domain:logging:1.1">
            <console-handler name="CONSOLE" autoflush="true">
              <level name="DEBUG" />
              <formatter>
                <pattern-formatter pattern="%d{yyyy.MM.dd HH:mm:ss} %-5p [%c] %s%E%n" />
              </formatter>
            </console-handler>
      
            <periodic-rotating-file-handler name="FILE" autoflush="true">
              <level name="INFO" />
              <formatter>
                <pattern-formatter pattern="%d{yyyy.MM.dd HH:mm:ss} %-5p [%c] %s%E%n" />
              </formatter>
              <file relative-to="jboss.server.log.dir" path="server.log" />
              <suffix value=".yyyy-MM-dd" />
            </periodic-rotating-file-handler>
      
            <periodic-rotating-file-handler name="SECURITY" autoflush="true">
              <level name="WARN" />
              <formatter>
                <pattern-formatter pattern="%d{yyyy.MM.dd HH:mm:ss} %-5p [%c] %s%E%n" />
              </formatter>
              <file relative-to="jboss.server.log.dir" path="server-security.log" />
              <suffix value=".yyyy-MM-dd" />
            </periodic-rotating-file-handler>
      
            <logger category="javax.security" use-parent-handlers="false">
              <level name="WARN" />
              <handlers>
                <handler name="SECURITY" />
              </handlers>
            </logger>
      
            <logger category="com.arjuna">
              <level name="WARN" />
            </logger>
            <logger category="org.apache.tomcat.util.modeler">
              <level name="WARN" />
            </logger>
            <logger category="sun.rmi">
              <level name="WARN" />
            </logger>
            <logger category="com.meyle" >
              <level name="DEBUG" />
            </logger>
            <root-logger>
              <level name="INFO" />
              <handlers>
                <handler name="CONSOLE" />
                <handler name="FILE" />
              </handlers>
            </root-logger>
          </subsystem>
      
        • 1. Re: Logging of specific category not working in 7.0.2?
          James Perkins Master

          I don't think there is any logging, at least in the JBoss AS7 code base, that is logged with the category "javax.security". While it's probably a good idea to keep that category since your runtime might log to it, you should probably also add "org.jboss.as.secrurity" as a logger category.

           

              <subsystem xmlns="urn:jboss:domain:logging:1.1">
                <console-handler name="CONSOLE" autoflush="true">
                  <level name="DEBUG" />
                  <formatter>
                    <pattern-formatter pattern="%d{yyyy.MM.dd HH:mm:ss} %-5p [%c] %s%E%n" />
                  </formatter>
                </console-handler>
          
          
                <periodic-rotating-file-handler name="FILE" autoflush="true">
                  <level name="INFO" />
                  <formatter>
                    <pattern-formatter pattern="%d{yyyy.MM.dd HH:mm:ss} %-5p [%c] %s%E%n" />
                  </formatter>
                  <file relative-to="jboss.server.log.dir" path="server.log" />
                  <suffix value=".yyyy-MM-dd" />
                </periodic-rotating-file-handler>
          
          
                <periodic-rotating-file-handler name="SECURITY" autoflush="true">
                  <formatter>
                    <pattern-formatter pattern="%d{yyyy.MM.dd HH:mm:ss} %-5p [%c] %s%E%n" />
                  </formatter>
                  <file relative-to="jboss.server.log.dir" path="server-security.log" />
                  <suffix value=".yyyy-MM-dd" />
                </periodic-rotating-file-handler>
          
          
                <logger category="javax.security" use-parent-handlers="false">
                  <level name="WARN"/>
                  <handlers>
                    <handler name="SECURITY" />
                  </handlers>
                </logger>
          
                <logger category="org.jboss.as.security" use-parent-handlers="false">
                  <level name="WARN" />
                  <handlers>
                    <handler name="SECURITY" />
                  </handlers>
                </logger> 
          
                <logger category="com.arjuna">
                  <level name="WARN" />
                </logger>
                <logger category="org.apache.tomcat.util.modeler">
                  <level name="WARN" />
                </logger>
                <logger category="sun.rmi">
                  <level name="WARN" />
                </logger>
                <logger category="com.meyle" >
                  <level name="DEBUG" />
                </logger>
                <root-logger>
                  <level name="INFO" />
                  <handlers>
                    <handler name="CONSOLE" />
                    <handler name="FILE" />
                  </handlers>
                </root-logger>
              </subsystem>
          
          
          

           

          Note too that the <level/> is probably better left off the SECURITY file handler. If you want to change the level on the logger from WARN to INFO or higher, then the file would not contain those messages.

           

          --

          James R. Perkins