Re: Configure composite filter for specific logger in Log4j2 via properties file

"Piotr P. Karwasz" <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <CAFmygFawXUNhTKVvLavnr9pxO3vkg1Yp=EC41h5SjNssHaZ2uw@mail.gmail.com>
Hi Ralph,

On Sun, 3 Apr 2022 at 19:00, Ralph Goers <[email protected]> wrote:
> The enhancement you suggest would make the properties configuration different than
> the other configuration formats as they all require the Filters element. This is yet another
> example of why most (or all) of the log4j 2 developers really do not like the properties
> format and wonder why so many people prefer it.

Yes, you are right, no need to introduce exceptions. Even if there is
only one filter, a property

logger.logger-id.filter.filter-id.type = ThresholdFilter

should be equivalent to:

<Loggers>
  <Logger ...>
    <Filters>
      <ThresholdFilter .../>

Right now the `PropertiesConfigurationBuilder` does not add the
"Filters" component, so the property above gives the equivalent of:

<Loggers>
  <Logger ...>
    <ThresholdFilter .../>

This works, but fails if the user configures more than one filter (as
it would in every configuration format). BTW, I think that a property:

logger.logger-id.filter-id.type = ThresholdFilter

should also work to define a single filter. Right now it is ignored by
the `PropertiesConfigurationBuilder`.

I would go even further, regarding the properties format: no Log4j2
developer uses it and that explains why there are still many bugs in
the `PropertiesConfiguration`.

Piotr
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.