4 Replies Latest reply on Oct 30, 2019 6:11 PM by jamezp

    Problems with a filter-spec in Wildfly 15

    davegleeds

      Is anyone aware of an issue with the filter-spec on a category in Wildfly 15?

       

      Basically the problem is that a filter-spec like this doesn't appear to be doing any filtering...

       

      match("Connection")

       

      Rows are still logged even though they don't match this spec.

       

      However, the same filter-spec on a handler does work and the logs are filtered.

       

      I don't know if this is specific to Wildfly 15, though I'm aiming to test on an earlier version when I get the chance.

        • 1. Re: Problems with a filter-spec in Wildfly 15
          davegleeds

          I've now installed Wildfly 17 and the problem persists

          • 2. Re: Problems with a filter-spec in Wildfly 15
            jamezp

            By default loggers don't inherit filters. Any filter-spec defined on a logger would only filter log messages that are logged directly to the logger. There is an open JIRA, WFCORE-3462, to expose the behavior of inheriting filters on a logger.

             

            This means that currently it's best to place the filter on a handler or directly on the logger that logs message. However in WildFly 18 you can use a custom filter.

             

            --

            James R. Perkins

            • 3. Re: Problems with a filter-spec in Wildfly 15
              davegleeds

              Thanks for the answer James but I'm still a little confused.

               

              When you mention a filter spec being defined on a logger, I presume that's not the same as a filter-spec on a category?

              I understand that a filter defined on a root logger is not inherited by other loggers but, when I create a category, doesn't that create a new logger?

               

              Sorry if this is basic 101 stuff I should know.

               

              At least I know now to add the filter-spec on the handler and that works fine for me.

              • 4. Re: Problems with a filter-spec in Wildfly 15
                jamezp

                Hi Dave,

                A category and a logger are really the same thing. The category is essentially the name for the logger, for example Logger.getLogger("org.jboss.example") has a name, category, of "org.jboss.example". As long as the filter-spec is defined on the specific logger you want filtered messages on then it should work.

                 

                --

                James R. Perkins