You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/06/06 23:17:00 UTC
[jira] [Commented] (LOG4J2-1721) Composite configuration using
log4jConfiguration context parameter
[ https://issues.apache.org/jira/browse/LOG4J2-1721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16504036#comment-16504036 ]
ASF GitHub Bot commented on LOG4J2-1721:
----------------------------------------
GitHub user fluxroot opened a pull request:
https://github.com/apache/logging-log4j2/pull/176
[LOG4J2-1721] Allow composite configuration for context parameter
For non-JNDI, allow comma-separated configuration locations (composite configuration syntax) for "log4jConfiguration" context parameter. This pull request implements LOG4J2-1721.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/fluxroot/logging-log4j2 LOG4J2-1721
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/logging-log4j2/pull/176.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #176
----
commit 2c571611e5dcf30912ed81c1fa47793fa1894783
Author: Phokham Nonava <pn...@...>
Date: 2018-06-06T14:32:21Z
[LOG4J2-1721] Allow composite configuration for context parameter
For non-JNDI, allow comma-separated configuration locations (composite
configuration syntax) for "log4jConfiguration" context parameter.
----
> Composite configuration using log4jConfiguration context parameter
> ------------------------------------------------------------------
>
> Key: LOG4J2-1721
> URL: https://issues.apache.org/jira/browse/LOG4J2-1721
> Project: Log4j 2
> Issue Type: Improvement
> Components: Configurators, Web/Servlet
> Affects Versions: 2.7
> Reporter: Pastrie
> Priority: Major
> Labels: features
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> Log4j allows multiple configuration files to be used by specifying them as a list of comma separated file paths on log4j.configurationFile property. This feature is not available in web environment since the log4jConfiguration context parameter accepts a single Path/File/URI.
> My proposal is to apply some small changes in the Log4jWebInitializerImpl class
> - change method getConfigURI to return List<URI> instead of URI.
> {code:title=Log4jWebInitializerImpl.java|borderStyle=solid}
> if (configLocation != null) {
> if (configLocation.contains(",")) {
> final String[] parts = configLocation.split(",");
> final List<URI> uris = new ArrayList<>(parts.length);
> for (final String part : parts) {
> final URL url = servletContext.getResource(part);
> if (url != null) {
> final URI uri = url.toURI();
> LOGGER.debug("getConfigURI found resource [{}] in servletContext at [{}]", uri, configLocation);
> uris.add(url);
> }
> }
> }
> {code}
> - change method initializeNonJndi
> {code:title=Log4jWebInitializerImpl.java|borderStyle=solid}
> [...]
> final List<URI> listUri = getConfigURI(location);
> this.loggerContext = Configurator.initialize(this.name, this.getClassLoader(), listUri, this.servletContext);
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)