5 Replies Latest reply on Oct 19, 2015 4:11 AM by marco -

    JBoss EAP 6.4 logging filter-spec

    marco - Newbie

      I'm trying to use the "filter-spec ..." definition independently for different handlers.

      The problem is that there is some kind of inheritance that I really cannot figure out: When using the "filter-spec ..." within the console-handler the filter is also applied within the size-rotating-file-handler but not the other way round.

      I want to use the filter within the console-handler only for the console-handler and the filter within the size-rotating-file-handler only for the size-rotating-file-hanlder.

      Current configuration looks similar to this (I've also tried it without the "filter-spec value="accept"" within the root-logger)

       

       

      <subsystem xmlns="urn:jboss:domain:logging:1.5">
              <console-handler name="CONSOLE">
                  <level name="DEBUG"/>
                  <filter-spec value="all(substituteAll(&quot;\n&quot;,&quot;/n&quot;), substituteAll(&quot;\r&quot;,&quot;/r&quot;), substituteAll(&quot;\t&quot;,&quot;/t&quot;))"/>
                  <formatter>
                      <named-formatter name="DEFAULT_LOG_PATTERN"/>
                  </formatter>
              </console-handler>
              <size-rotating-file-handler name="SFILE">
                  <level name="INFO"/>
                  <filter-spec value="all(substituteAll(&quot;a&quot;,&quot;AA&quot;), substituteAll(&quot;e&quot;,&quot;EE&quot;)), levels(INFO)"/>
                  <formatter>
                      <named-formatter name="DEFAULT_LOG_PATTERN"/>
                  </formatter>
                  <file relative-to="jboss.server.log.dir" path="sizerotated.log"/>
                  <rotate-size value="1M"/>
                  <max-backup-index value="15"/>
                  <append value="true"/>
              </size-rotating-file-handler>
              <logger category="org.hibernate.SQL">
                  <level name="DEBUG"/>
                  <filter-spec value="accept"/>
              </logger>
              ...
              <root-logger>
                  <level name="INFO"/>
                  <filter-spec value="accept"/>
                  <handlers>
                      <handler name="CONSOLE"/>
                      <handler name="SFILE"/>
                  </handlers>
              </root-logger>
              <formatter name="DEFAULT_LOG_PATTERN">
                  <pattern-formatter pattern="&quot;%d{yyyy-MM-dd HH:mm:ss.......;%E&quot;;%n"/>
              </formatter>
          </subsystem>
      
      

       

      I found out that if the order of the handlers within the "root-logger" is changed to:

       

       <handler name="SFILE"/>
       <handler name="CONSOLE"/>
      

       

      then the inheritance is the other way round.