You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2016/09/24 02:01:17 UTC
logging-log4j2 git commit: Convert properties.
Repository: logging-log4j2
Updated Branches:
refs/heads/master 762f601a9 -> 4c751c683
Convert properties.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4c751c68
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4c751c68
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4c751c68
Branch: refs/heads/master
Commit: 4c751c6832626db8b8c308a98e7107a50fd13f5a
Parents: 762f601
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Sep 23 19:01:14 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Sep 23 19:01:14 2016 -0700
----------------------------------------------------------------------
.../apache/log4j/config/Log4j1ConfigurationParser.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4c751c68/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
----------------------------------------------------------------------
diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
index bdcc32d..be9d4b9 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
@@ -21,6 +21,7 @@ import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
import java.util.Properties;
import javax.swing.text.StyledEditorKit.ForegroundAction;
@@ -41,6 +42,7 @@ import org.apache.logging.log4j.core.config.builder.api.RootLoggerComponentBuild
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
import org.apache.logging.log4j.core.lookup.StrSubstitutor;
import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.Strings;
import org.apache.velocity.runtime.directive.Foreach;
/**
@@ -120,12 +122,22 @@ public class Log4j1ConfigurationParser {
// Loggers
buildLoggers("log4j.category.");
buildLoggers("log4j.logger.");
+ buildProperties();
return builder;
} catch (final IllegalArgumentException e) {
throw new ConfigurationException(e);
}
}
+ private void buildProperties() {
+ for (Map.Entry<Object, Object> entry : properties.entrySet()) {
+ final String key = entry.getKey().toString();
+ if (!key.startsWith("log4j.") && !key.equals(ROOTCATEGORY) && !key.equals(ROOTLOGGER)) {
+ builder.addProperty(key, Objects.toString(entry.getValue(), Strings.EMPTY));
+ }
+ }
+ }
+
private void warn(String string) {
System.err.println(string);
}