[ 
https://issues.apache.org/jira/browse/LOG4J2-540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dushyant Pandya updated LOG4J2-540:
-----------------------------------

    Labels: configuration configuration-addition features location  (was: 
features)

> Add an ability to load an alternative Log4j config file
> -------------------------------------------------------
>
>                 Key: LOG4J2-540
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-540
>             Project: Log4j 2
>          Issue Type: Wish
>    Affects Versions: 2.0-beta9
>            Reporter: Dushyant Pandya
>              Labels: configuration, configuration-addition, features, location
>
> *Current Situation:*
> In case of web applications, the Log4J2 loads a config file specified by the 
> servlet context init param *log4jConfiguration*. If the location is 
> *classpath:* location then that config file would be searched somewhere in 
> the classpath. Usually, to keep the web application WAR self sufficient the 
> config file is bundled in *WEB-INF/classes* dir of the WAR itself.
> *Problem:*
> The config file usually has machine/env dependent information like the log 
> file location, the log levels etc. These values and sometimes the whole file 
> may be different depending upon where the app is running (e.g., developer 
> machine, qa or production etc). In many organizations, the deployment 
> scripts/tools specify these files per env or alter the values per env during 
> deployment time. This is very difficult to do if the config file is bundled 
> inside the WAR. An alternative is to NOT bundle the config file inside WAR 
> and put it in some system classpath location but that solution makes the WAR 
> not self contained. 
> *Wish:*
> Wish there was an ability to specify a preferred log4j config file that will 
> be used if it exists and a fallback config file location if the preferred 
> config file doesn't exist. 
> For example, with the following in _web.xml_
> {code}
>    <context-param>
>       <param-name>log4jConfiguration</param-name>
>       <param-value>file:///file1.xml,classpath:file2.xml</param-value>
>    </context-param>
> {code}
> The _file1.xml_ can be somewhere on file system or external classpath 
> location and could be env specific. The _file2.xml_ can be the default file 
> bundled in the WAR itself. If _file1.xml_ exists then it will take the 
> precedence, if it doesn't exist then _file2.xml_ will be used. This idea is 
> similar to the way _Spring Framework_ allows specifying multiple values to 
> the *location* attribute when specifying [property 
> placeholder|http://docs.spring.io/spring/docs/4.0.1.RELEASE/spring-framework-reference/htmlsingle/#beans-factory-placeholderconfigurer].



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

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

Reply via email to