Re: can we set log4j property 'Log4jContextSelector' per webapps war

"Piotr P. Karwasz" <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <CAFmygFY=SHdwjWKq-BE+v55=pL8-pDpq40GzVwje7jsftX_68w@mail.gmail.com>
Hi Ralph,

On Thu, 7 Apr 2022 at 07:50, Ralph Goers <[email protected]> wrote:
> Second, putting the property in log4j2.component.properties is correct. However, it must only be on the classpath of the web app that needs it, not in a shared directory.

If there is no `log4j-api` in the web app classpath, I would refrain
from adding a `log4j2.component.properties` to that application.

Currently most components use a single `PropertiesUtil` instance, that
is created when `log4j-api` is first initialized. If multiple
applications are using the same `log4j-api` the
`log4j.component.properties` files contained in all but the first
application will be ignored.

That is why I would propose to remove thread context classloader
support from `PropertiesUtil` in future 2.x releases or check all the
call sites of `PropertiesUtil.getProperties()` to see if they need
application specific properties or not. Of course in 3.x your
properties enhancement proposal solves most problems.

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.