This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/main by this push:
     new 57af66b97e LOG4J2-3658 - Allow Log4j 2 properties in JSON files
57af66b97e is described below

commit 57af66b97ed789d8bc93bb43e22c557899ad4ced
Author: Ralph Goers <rgo...@apache.org>
AuthorDate: Sun Apr 9 17:03:58 2023 -0700

    LOG4J2-3658 - Allow Log4j 2 properties in JSON files
---
 .../logging/log4j/util/PropertiesUtilTest.java     |  11 +++
 .../src/test/resources/PropertiesUtilTest.json     |  25 +++++
 .../logging/log4j/util/JsonPropertySource.java     | 104 +++++++++++++++++++++
 .../org/apache/logging/log4j}/util/JsonReader.java |   2 +-
 .../apache/logging/log4j/util/PropertiesUtil.java  |  60 +++++++++++-
 .../logging/log4j/core/util/JsonReaderTest.java    |  11 ++-
 .../log4j/core/config/jason/JsonConfiguration.java |   4 +-
 .../JsonTemplateLayoutAdditionalFieldTest.java     |  12 +--
 .../log4j/layout/template/json/TestHelpers.java    |   2 +-
 .../json/resolver/CounterResolverTest.java         |   6 +-
 .../json/resolver/MessageResolverTest.java         |  16 ++--
 .../json/resolver/CaseConverterResolver.java       |   8 +-
 .../resolver/EventAdditionalFieldInterceptor.java  |   6 +-
 .../template/json/resolver/TemplateResolvers.java  |   6 +-
 .../json/JsonTemplateLayoutBenchmarkReport.java    |   6 +-
 .../.3.x.x/LOG4J2-3658_Allow_Json_Properties.xml   |  25 +++++
 16 files changed, 259 insertions(+), 45 deletions(-)

diff --git 
a/log4j-api-test/src/test/java/org/apache/logging/log4j/util/PropertiesUtilTest.java
 
b/log4j-api-test/src/test/java/org/apache/logging/log4j/util/PropertiesUtilTest.java
index 94ac38d882..7cf423ad30 100644
--- 
a/log4j-api-test/src/test/java/org/apache/logging/log4j/util/PropertiesUtilTest.java
+++ 
b/log4j-api-test/src/test/java/org/apache/logging/log4j/util/PropertiesUtilTest.java
@@ -111,6 +111,17 @@ public class PropertiesUtilTest {
         }
     }
 
+    @Test
+    @ResourceLock(Resources.SYSTEM_PROPERTIES)
+    public void testJsonProperties() {
+        final PropertiesUtil util = new 
PropertiesUtil("PropertiesUtilTest.json");
+        assertNull(util.getStringProperty("log4j2"));
+        assertEquals(true, 
util.getBooleanProperty("log4j2.My-App.JNDI.enableJMS"));
+        assertEquals("Groovy,JavaScript", 
util.getStringProperty("log4j2.My-App.Script.enableLanguages"));
+        assertEquals("com.acme.log4j.CustomMergeStrategy", 
util.getStringProperty("log4j2.My-App.Configuration.mergeStrategy"));
+        assertEquals("Info", 
util.getStringProperty("log4j2.*.StatusLogger.defaultStatusLevel"));
+    }
+
     @Test
     @ResourceLock(value = Resources.SYSTEM_PROPERTIES, mode = 
ResourceAccessMode.READ)
     public void testPublish() {
diff --git a/log4j-api-test/src/test/resources/PropertiesUtilTest.json 
b/log4j-api-test/src/test/resources/PropertiesUtilTest.json
new file mode 100644
index 0000000000..40afc6dfe9
--- /dev/null
+++ b/log4j-api-test/src/test/resources/PropertiesUtilTest.json
@@ -0,0 +1,25 @@
+{
+  "log4j2": {
+    "My-App": {
+      "JNDI": {
+        "enableJMS": "true"
+      },
+      "Script": {
+        "enableLanguages": [
+          "Groovy",
+          "JavaScript"
+        ]
+      },
+      "Configuration": {
+        "mergeStrategy": "com.acme.log4j.CustomMergeStrategy",
+        "location": "classpath:log4j2-My-App.xml",
+        "statusLoggerLevel": "debug"
+      }
+    },
+    "*": {
+      "StatusLogger": {
+        "defaultStatusLevel": "Info"
+      }
+    }
+  }
+}
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/util/JsonPropertySource.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/JsonPropertySource.java
new file mode 100644
index 0000000000..17f2b53459
--- /dev/null
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/JsonPropertySource.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.util;
+
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Allows Properties to be specified as JSON.
+ */
+public class JsonPropertySource implements PropertySource {
+    private static final int DEFAULT_PRIORITY = 200;
+
+    private final int priority;
+
+    private final PropertiesPropertySource propertySource;
+
+    public JsonPropertySource(final String json) {
+        this(json, DEFAULT_PRIORITY);
+    }
+
+    public JsonPropertySource(final String json, final int priority) {
+        final Map<String, Object> root = Cast.cast(JsonReader.read(json));
+        Properties props = new Properties();
+        populateProperties(props, "", root);
+        propertySource = new PropertiesPropertySource(props);
+        this.priority = priority;
+    }
+
+    @Override
+    public int getPriority() {
+        return priority;
+    }
+
+    @Override
+    public void forEach(BiConsumer<String, String> action) {
+        propertySource.forEach(action);
+    }
+
+    @Override
+    public Collection<String> getPropertyNames() {
+        return propertySource.getPropertyNames();
+    }
+
+    @Override
+    public CharSequence getNormalForm(Iterable<? extends CharSequence> tokens) 
{
+        return propertySource.getNormalForm(tokens);
+    }
+
+    @Override
+    public String getProperty(String key) {
+        return propertySource.getProperty(key);
+    }
+
+    @Override
+    public boolean containsProperty(String key) {
+        return propertySource.containsProperty(key);
+    }
+
+    private void populateProperties(Properties props, String prefix, 
Map<String, Object> root) {
+        if (!root.isEmpty()) {
+            for (Map.Entry<String, Object> entry : root.entrySet()) {
+                if (entry.getValue() instanceof String) {
+                    props.setProperty(createKey(prefix, entry.getKey()), 
(String) entry.getValue());
+                } else if (entry.getValue() instanceof List) {
+                    final StringBuilder sb = new StringBuilder();
+                    ((List<Object>) entry.getValue()).forEach((obj) -> {
+                        if (sb.length() > 0) {
+                            sb.append(",");
+                        }
+                        sb.append(obj.toString());
+                    });
+                    props.setProperty(createKey(prefix, entry.getKey()), 
sb.toString());
+                } else {
+                    populateProperties(props, createKey(prefix, 
entry.getKey()), (Map<String, Object>) entry.getValue());
+                }
+            }
+        }
+    }
+
+    private String createKey(String prefix, String suffix) {
+        if (prefix.isEmpty()) {
+            return suffix;
+        }
+        return prefix + "." + suffix;
+    }
+}
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/JsonReader.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/JsonReader.java
similarity index 99%
rename from 
log4j-core/src/main/java/org/apache/logging/log4j/core/util/JsonReader.java
rename to log4j-api/src/main/java/org/apache/logging/log4j/util/JsonReader.java
index 37dc60eaeb..d30ca637e0 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/JsonReader.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/JsonReader.java
@@ -14,7 +14,7 @@
  * See the license for the specific language governing permissions and
  * limitations under the license.
  */
-package org.apache.logging.log4j.core.util;
+package org.apache.logging.log4j.util;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index d96b78f470..eb1d18d7e2 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -16,8 +16,15 @@
  */
 package org.apache.logging.log4j.util;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.lang.invoke.MethodHandles;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -46,6 +53,7 @@ import java.util.concurrent.ConcurrentSkipListSet;
 public class PropertiesUtil implements PropertyEnvironment {
 
     private static final String LOG4J_PROPERTIES_FILE_NAME = 
"log4j2.component.properties";
+    private static final String LOG4J_JSON_FILE_NAME = "log4j2.component.json";
     private static final String LOG4J_SYSTEM_PROPERTIES_FILE_NAME = 
"log4j2.system.properties";
     private static final Lazy<PropertiesUtil> COMPONENT_PROPERTIES =
             Lazy.lazy(() -> new PropertiesUtil(LOG4J_PROPERTIES_FILE_NAME));
@@ -72,7 +80,13 @@ public class PropertiesUtil implements PropertyEnvironment {
     }
 
     private PropertiesUtil(final String propertiesFileName, final boolean 
useTccl) {
-        this.environment = new Environment(new 
PropertyFilePropertySource(propertiesFileName, useTccl));
+        List<PropertySource> sources = new ArrayList<>();
+        if (propertiesFileName.endsWith(".json") || 
propertiesFileName.endsWith(".jsn")) {
+            sources.addAll(getJsonPropertySources(propertiesFileName, true));
+        } else {
+            sources.add(new PropertyFilePropertySource(propertiesFileName, 
useTccl));
+        }
+        this.environment = new Environment(sources);
     }
 
     /**
@@ -80,7 +94,8 @@ public class PropertiesUtil implements PropertyEnvironment {
      * @param source a property source
      */
     PropertiesUtil(final PropertySource source) {
-        this.environment = new Environment(source);
+        List<PropertySource> sources = Collections.singletonList(source);
+        this.environment = new Environment(sources);
     }
 
     /**
@@ -93,7 +108,10 @@ public class PropertiesUtil implements PropertyEnvironment {
     }
 
     public static PropertyEnvironment getProperties(final String namespace) {
-        return new Environment(new 
PropertyFilePropertySource(String.format("log4j2.%s.properties", namespace)));
+        List<PropertySource> sources = new ArrayList<>();
+        sources.add(new 
PropertyFilePropertySource(String.format("log4j2.%s.properties", namespace)));
+        sources.addAll(getJsonPropertySources(String.format("log4j2.%s.json", 
namespace), true));
+        return new Environment(sources);
     }
 
     public static ResourceBundle getCharsetsResourceBundle() {
@@ -172,6 +190,38 @@ public class PropertiesUtil implements PropertyEnvironment 
{
         environment.reload();
     }
 
+    private static List<PropertySource> getJsonPropertySources(String 
fileName, boolean useTccl) {
+        List<PropertySource> sources = new ArrayList<>();
+        if (fileName.startsWith("file://")) {
+            try {
+                URL url = new URL(fileName);
+                sources.add(new JsonPropertySource(new 
String(url.openStream().readAllBytes(),
+                        StandardCharsets.UTF_8)));
+            } catch (Exception ex) {
+                LowLevelLogUtil.logException("Unable to read " + fileName, ex);
+            }
+        } else {
+            File file = new File(fileName);
+            if (file.exists()) {
+                try {
+                    sources.add(new JsonPropertySource(new String(new 
FileInputStream(file).readAllBytes(),
+                            StandardCharsets.UTF_8)));
+                } catch (IOException ioe) {
+                    LowLevelLogUtil.logException("Unable to read " + fileName, 
ioe);
+                }
+            } else {
+                for (final URL url : LoaderUtil.findResources(fileName, 
useTccl)) {
+                    try (final InputStream in = url.openStream()) {
+                        sources.add(new JsonPropertySource(new 
String(in.readAllBytes(), StandardCharsets.UTF_8)));
+                    } catch (final IOException e) {
+                        LowLevelLogUtil.logException("Unable to read " + url, 
e);
+                    }
+                }
+            }
+        }
+        return sources;
+    }
+
     /**
      * Provides support for looking up global configuration properties via 
environment variables, property files,
      * and system properties, in three variations:
@@ -194,7 +244,7 @@ public class PropertiesUtil implements PropertyEnvironment {
         private final Map<String, String> literal = new ConcurrentHashMap<>();
         private final Map<List<CharSequence>, String> tokenized = new 
ConcurrentHashMap<>();
 
-        private Environment(final PropertySource propertySource) {
+        private Environment(final List<PropertySource> propertySources) {
             final PropertyFilePropertySource sysProps = new 
PropertyFilePropertySource(LOG4J_SYSTEM_PROPERTIES_FILE_NAME);
             try {
                 sysProps.forEach((key, value) -> {
@@ -205,7 +255,7 @@ public class PropertiesUtil implements PropertyEnvironment {
             } catch (final SecurityException ex) {
                 // Access to System Properties is restricted so just skip it.
             }
-            sources.add(propertySource);
+            sources.addAll(propertySources);
             final ServiceRegistry registry = ServiceRegistry.getInstance();
             // Does not log errors using StatusLogger, which depends on 
PropertiesUtil being initialized.
             sources.addAll(registry.getServices(PropertySource.class, 
MethodHandles.lookup(), null, /*verbose=*/false));
diff --git 
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/JsonReaderTest.java
 
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/JsonReaderTest.java
index 5da282052d..e3bf5a8ced 100644
--- 
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/JsonReaderTest.java
+++ 
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/JsonReaderTest.java
@@ -16,11 +16,6 @@
  */
 package org.apache.logging.log4j.core.util;
 
-import org.assertj.core.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.ValueSource;
-
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.Arrays;
@@ -28,6 +23,12 @@ import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
+import org.apache.logging.log4j.util.JsonReader;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
 class JsonReaderTest {
 
     @Test
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/jason/JsonConfiguration.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/jason/JsonConfiguration.java
index 18f1cf2604..26495adc92 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/jason/JsonConfiguration.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/jason/JsonConfiguration.java
@@ -19,7 +19,6 @@ package org.apache.logging.log4j.core.config.jason;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -32,12 +31,11 @@ import 
org.apache.logging.log4j.core.config.ConfigurationSource;
 import org.apache.logging.log4j.core.config.LoggerConfig;
 import org.apache.logging.log4j.core.config.Reconfigurable;
 import org.apache.logging.log4j.core.config.status.StatusConfiguration;
-import org.apache.logging.log4j.core.util.JsonReader;
-import org.apache.logging.log4j.core.util.Patterns;
 import org.apache.logging.log4j.plugins.Node;
 import org.apache.logging.log4j.plugins.model.PluginType;
 import org.apache.logging.log4j.plugins.util.ResolverUtil;
 import org.apache.logging.log4j.util.Cast;
+import org.apache.logging.log4j.util.JsonReader;
 
 public class JsonConfiguration extends AbstractConfiguration implements 
Reconfigurable {
     private static final String[] VERBOSE_CLASSES = new String[] { 
ResolverUtil.class.getName() };
diff --git 
a/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutAdditionalFieldTest.java
 
b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutAdditionalFieldTest.java
index e5580f4172..351a9497fb 100644
--- 
a/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutAdditionalFieldTest.java
+++ 
b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutAdditionalFieldTest.java
@@ -16,22 +16,22 @@
  */
 package org.apache.logging.log4j.layout.template.json;
 
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.test.appender.ListAppender;
 import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
 import org.apache.logging.log4j.core.test.junit.Named;
-import org.apache.logging.log4j.core.util.JsonReader;
+import org.apache.logging.log4j.util.JsonReader;
 import org.assertj.core.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.parallel.Execution;
 import org.junit.jupiter.api.parallel.ExecutionMode;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
 @Execution(ExecutionMode.SAME_THREAD)
 class JsonTemplateLayoutAdditionalFieldTest {
 
diff --git 
a/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/TestHelpers.java
 
b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/TestHelpers.java
index 6a8a4a90e9..59316936fb 100644
--- 
a/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/TestHelpers.java
+++ 
b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/TestHelpers.java
@@ -32,9 +32,9 @@ import 
org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilder;
 import 
org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory;
 import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
 import org.apache.logging.log4j.core.test.appender.ListAppender;
-import org.apache.logging.log4j.core.util.JsonReader;
 import org.apache.logging.log4j.layout.template.json.util.JsonWriter;
 import org.apache.logging.log4j.layout.template.json.util.MapAccessor;
+import org.apache.logging.log4j.util.JsonReader;
 
 public final class TestHelpers {
 
diff --git 
a/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CounterResolverTest.java
 
b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CounterResolverTest.java
index 3b6b9586ab..af36ed518c 100644
--- 
a/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CounterResolverTest.java
+++ 
b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CounterResolverTest.java
@@ -16,14 +16,14 @@
  */
 package org.apache.logging.log4j.layout.template.json.resolver;
 
+import java.math.BigInteger;
+
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.impl.Log4jLogEvent;
-import org.apache.logging.log4j.core.util.JsonReader;
 import org.apache.logging.log4j.layout.template.json.JsonTemplateLayout;
+import org.apache.logging.log4j.util.JsonReader;
 import org.junit.jupiter.api.Test;
 
-import java.math.BigInteger;
-
 import static org.apache.logging.log4j.layout.template.json.TestHelpers.*;
 import static org.assertj.core.api.Assertions.assertThat;
 
diff --git 
a/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/MessageResolverTest.java
 
b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/MessageResolverTest.java
index 999a6862e6..78d684bf76 100644
--- 
a/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/MessageResolverTest.java
+++ 
b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/MessageResolverTest.java
@@ -16,27 +16,27 @@
  */
 package org.apache.logging.log4j.layout.template.json.resolver;
 
+import java.nio.charset.StandardCharsets;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.impl.Log4jLogEvent;
 import org.apache.logging.log4j.core.test.appender.ListAppender;
 import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
 import org.apache.logging.log4j.core.test.junit.Named;
-import org.apache.logging.log4j.core.util.JsonReader;
 import org.apache.logging.log4j.layout.template.json.JsonTemplateLayout;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.ObjectMessage;
 import org.apache.logging.log4j.message.SimpleMessage;
 import org.apache.logging.log4j.message.StringMapMessage;
+import org.apache.logging.log4j.util.JsonReader;
 import org.assertj.core.api.Assertions;
 import org.junit.jupiter.api.Test;
 
-import java.nio.charset.StandardCharsets;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
 import static org.apache.logging.log4j.layout.template.json.TestHelpers.*;
 import static org.assertj.core.api.Assertions.assertThat;
 
diff --git 
a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/CaseConverterResolver.java
 
b/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/CaseConverterResolver.java
index 118dcfeafd..9d82800c68 100644
--- 
a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/CaseConverterResolver.java
+++ 
b/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/CaseConverterResolver.java
@@ -16,13 +16,13 @@
  */
 package org.apache.logging.log4j.layout.template.json.resolver;
 
+import java.util.Locale;
+import java.util.function.Function;
+
 import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.util.JsonReader;
 import 
org.apache.logging.log4j.layout.template.json.JsonTemplateLayoutDefaults;
 import org.apache.logging.log4j.layout.template.json.util.JsonWriter;
-
-import java.util.Locale;
-import java.util.function.Function;
+import org.apache.logging.log4j.util.JsonReader;
 
 /**
  * Converts the case of string values.
diff --git 
a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/EventAdditionalFieldInterceptor.java
 
b/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/EventAdditionalFieldInterceptor.java
index a3e3395d3f..0a9003b057 100644
--- 
a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/EventAdditionalFieldInterceptor.java
+++ 
b/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/EventAdditionalFieldInterceptor.java
@@ -16,13 +16,13 @@
  */
 package org.apache.logging.log4j.layout.template.json.resolver;
 
-import org.apache.logging.log4j.core.util.JsonReader;
+import java.util.Map;
+
 import 
org.apache.logging.log4j.layout.template.json.JsonTemplateLayout.EventTemplateAdditionalField;
 import org.apache.logging.log4j.plugins.Namespace;
 import org.apache.logging.log4j.plugins.Plugin;
 import org.apache.logging.log4j.plugins.PluginFactory;
-
-import java.util.Map;
+import org.apache.logging.log4j.util.JsonReader;
 
 /**
  * Interceptor to add {@link EventTemplateAdditionalField
diff --git 
a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/TemplateResolvers.java
 
b/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/TemplateResolvers.java
index adc40c09ac..e05484b859 100644
--- 
a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/TemplateResolvers.java
+++ 
b/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/TemplateResolvers.java
@@ -16,9 +16,6 @@
  */
 package org.apache.logging.log4j.layout.template.json.resolver;
 
-import org.apache.logging.log4j.core.util.JsonReader;
-import org.apache.logging.log4j.layout.template.json.util.JsonWriter;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -26,6 +23,9 @@ import java.util.Objects;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
+import org.apache.logging.log4j.layout.template.json.util.JsonWriter;
+import org.apache.logging.log4j.util.JsonReader;
+
 /**
  * Main class for compiling {@link TemplateResolver}s from a template.
  */
diff --git 
a/log4j-perf/src/main/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutBenchmarkReport.java
 
b/log4j-perf/src/main/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutBenchmarkReport.java
index c971570646..ae6b180922 100644
--- 
a/log4j-perf/src/main/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutBenchmarkReport.java
+++ 
b/log4j-perf/src/main/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutBenchmarkReport.java
@@ -16,9 +16,6 @@
  */
 package org.apache.logging.log4j.layout.template.json;
 
-import org.apache.logging.log4j.core.util.JsonReader;
-import org.apache.logging.log4j.util.Strings;
-
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -40,6 +37,9 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
+import org.apache.logging.log4j.util.JsonReader;
+import org.apache.logging.log4j.util.Strings;
+
 /**
  * Utility class to summarize {@link JsonTemplateLayoutBenchmark} results in 
Asciidoctor.
  * <p>
diff --git a/src/changelog/.3.x.x/LOG4J2-3658_Allow_Json_Properties.xml 
b/src/changelog/.3.x.x/LOG4J2-3658_Allow_Json_Properties.xml
new file mode 100644
index 0000000000..40ee721267
--- /dev/null
+++ b/src/changelog/.3.x.x/LOG4J2-3658_Allow_Json_Properties.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns="http://logging.apache.org/log4j/changelog";
+       xsi:schemaLocation="http://logging.apache.org/log4j/changelog 
https://logging.apache.org/log4j/changelog-0.1.1.xsd";
+       type="changed">
+  <issue id="LOG4J2-3658" 
link="https://issues.apache.org/jira/browse/LOG4J2-3658"/>
+  <author id="rgoers"/>
+  <description format="asciidoc">Allow Log4j properties to be provided in JSON 
files.</description>
+</entry>

Reply via email to