Hi Piers,

On Wed, 20 Mar 2024 at 17:09, Piers Uso Walter <piers.wal...@ilink.de> wrote:
> Am I trying something unusual here when I attempt to make the app decide 
> where the log4j configuration file is located?
> Is there any other way in which I can achieve this?
> Is there an API for this?

Sorry for the late answer.

There are two solutions I could think of:

1. You could use a custom system variable (e.g.
`ilink.log4j2.configurationFile` and place:

    <context-param>
        <param-name>log4jConfiguration</param-name>
        
<param-value>${sys:ilink.log4j2.configurationFile:-classpath:path_to_default_config_file</param-value>
    </context-param>

2. You could write container specific documentation:

    * Tomcat supports the possibility to override context parameters
in an appropriate `context.xml` file:
https://tomcat.apache.org/tomcat-9.0-doc/config/index.html
    * I don't have too much experiance with JBoss, but it supports
variable substitution in web descriptors and you could use a
`jboss-web.xml` file to prevent Tomcat from using it.

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