Hi Piers, On Thu, 14 Mar 2024 at 14:08, Piers Uso Walter <piers.wal...@ilink.de> wrote: > However, what I was trying to achieve by using a servlet context listener was > to be able to set the location of the log4j configuration file at run time. > I’m trying to make the app compatible with different app servers where > configuration files are typically placed in different locations. > So I’m figuring out at run time which app server the app is running in, and > based on that I know where to expect the log4j configuration file.
Can provide more details as to where the path to the configuration file is actually stored? If you change the `log4j2.configurationFile` property, other web apps on the same server will be affected, which might be an unpleasant surprise to users. There are less invasive ways to do that. I also wonder if maintaining container specific code is worth the effort. Many application servers have a detailed guide to configuring logging (e.g. WildFly[1]). Users might be unwilling to learn yet another way to configure logging. Sure, Tomcat is an exception, that is why I maintain a small set of Log4j Core plugins and Tomcat extensions[2] to help users administering logging at a global level. Piotr [1] https://docs.wildfly.org/31/Admin_Guide.html#Logging [2] https://github.com/copernik-eu/log4j-tomcat --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org