Hi Arbi,

On 29.04.2025 21:22, Arbi Sookazian wrote:
Strike my previous comment regarding testing1 (it's not configured for separate 
logging and is likely logging to catalina.out).Any possible reasons why 
potentially log4j2.component.properties is not being scanned or fail to read 
key/value pairs in WEB-INF/classes dir?  Does it depend on the deployment 
folder hierarchical structure?  This is exploded app like my dev envmt.  thanks.

As far as I understand your `log4j2.component.properties` file is in the `WEB-INF/classes` folder of an application, while `log4j-api` is in a classloader shared by all applications.

Older version of Log4j API used the thread context classloader to load resources, this means that

 * if Log4j API is initialized while your application is active, it
   will read the `log4j2.component.properties` file.
 * if Log4j API is initialized while *another* application is active,
   it will not find it.

The QA server certainly has more applications running, than your dev machine, so the second case occurs more often.

To prevent this from happening I would either move the `log4j2.component.properties` into the shared classloader or add the properties to `$CATALINA_BASE/conf/catalina.properties`.

Piotr


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to