Uploaded image for project: 'JBoss Log Manager'
  1. JBoss Log Manager
  2. LOGMGR-45

Have loggers inherit filters

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0.Final
    • None
    • None
    • None

      I had the need to log a specific INFO message and only that message. This message was logged from a class whose category is org.jboss.as.server. To get the message to even ask itself to be logged, I had to add the following to the log configuration (my STATUS handler was a simple console-handler). Given this, I saw a lot of INFO+ messages for the org.jboss.as.server category as well as other subcategories (e.g., org.jboss.as.server.deployment).

      <logger category="org.jboss.as.server">
      <level name="INFO"/>
      <handlers>
      <handler name="STATUS"/>
      </handlers>
      </logger>

      Next, I tried to restrict it by adding the <filter> element to the <logger>.

      <filter>
      <match pattern="JBAS018559"/>
      </filter>

      This did not appear to work...it made no impact on what was logged. So I moved it to the <console-handler> which only logged what I wanted it to log.

      In the forum post, it was determined the <filter> on the <logger> is not inherited. As a result, the <filter> is only applied to the specified category, not any of its subcategories.

      This request is to change the <logger> such that its <filter> is applied to all categories it applies itself to. From my point of view (and I realize it may be a limited view at this time), this keeps it consistent (e.g., <level> applies to all categories, <handler> applies to all categories). W/ no documentation on this feature, inheritance was assumed.

      Also, given it currently does not apply to all categories, does it make log configurations more complicated? In my case, I was able to easily move it to my handler but no one else was referencing it. If it had been in use by someone else, would I have had to create a new handler to be referenced only by the logger? Or would the filter have been able to be written in more complexity to allow logging of all it currently logs + one message - everything the new logger lets pass through? Or could one create additional loggers for sub-categories to set level=ERROR? (All rhetorical questions.)

            jperkins-rhn James Perkins
            kdolan1 Kelly Dolan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: