3 Replies Latest reply on Jul 11, 2012 7:17 AM by centecbertl

    log filter that matches 'this' or 'that'

    kdolan1

      The good news is I already have a solution.  I'm curious if anyone knows why my other tries did not work or can provide some additional context.

       

      I have a console-handler that has a filter such that only one specific log message (e.g., Deployed app) gets logged.

       

                  <console-handler name="STATUS" autoflush="true">

                      <level name="INFO"/>

                      <filter>

                          <match pattern="JBAS018559"/>

                      </filter>

                      <formatter>

                          <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n"/>

                      </formatter>

                      <target name="System.out"/>

                  </console-handler>

       

      I wanted to add another message (e.g., Composite operation was rolled back) to this such that now two specific log messages get logged.  My first change was to make filter look like the one below (I found a post w/ an example like this except it was using <not>).

       

                      <filter>

                          <any>

                              <match pattern="JBAS014654"/>

                              <match pattern="JBAS018559"/>

                           </any>

                      </filter>

       

      This did not work.  Only one message will actually be logged on start-up (either apps deploy or they don't) so I only expected to see one or the other.  However, JBoss re-writes standalone.xml and in doing so, ripped out the other <match> element.  This would mean on re-start, JBoss would never print the other message if in fact that was the message encountered.

       

      BTW - I also tried <all> as a group element.  Same behavior.

       

      The help text generated by the CLI talks about chaining multiple conditions but I could not find examples of this.  The above was my attempt at this.  Perhaps I was doing it wrong.

       

      Ultimately, my solution took advantage of the pattern value being able to be a regular expression.  I'm just wondering if there is a different way in case I ever find myself in need of something more complex that cannot be represented in a regular expression.

       

                     <filter>

                          <match pattern="JBAS014654|JBAS018559"/>

                     </filter>

       

      Thoughts?

       

      Kelly

        • 1. Re: log filter that matches 'this' or 'that'
          centecbertl

          This still happens in a JBoss AS 7 checked out from the 7.1 branch as of 3. July 2012:

           

          commit cba34fee6e5073c56c3ba8414cbc438c93222906

          CommitDate: Tue Jul 3 16:12:07 2012 -0500

           

          I added a filter expressin with a "all" multiFilterType according to the jboss-as-logging_1_1.xsd to suppress some known WARNINGS and errors:

           

          <filter>

             <all>

               <not>

                        <match pattern="MSC00002:"/>

               </not>

               <not>

                        <match pattern="ISPN000133:"/>

               </not>

              </all>

          </filter>

           

          which was modified identified (and written into the standalone.xml file generated by the jboss-as instance) as (second not condtion ignored and removed)

           

          <filter>

             <all>

               <not>

                        <match pattern="MSC00002:"/>

               </not>

              </all>

          </filter>

           

          Did you create a JIRA issue for this already?

           

          Robert

          • 2. Re: log filter that matches 'this' or 'that'
            jaikiran

            Looks like a bug. Please create a JIRA.

            • 3. Re: log filter that matches 'this' or 'that'
              centecbertl

              I found an already existing issue for this: https://issues.jboss.org/browse/AS7-5043