This is an automated email from the ASF dual-hosted git repository.
mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/master by this push:
new d444450938 LOG4J2-3521 - Lazy init for PropertiesUtil::getProperties
d444450938 is described below
commit d4444509386fe1db49c698f0c7faf122c33ca2f5
Author: Matt Sicker <[email protected]>
AuthorDate: Thu May 26 21:38:24 2022 -0500
LOG4J2-3521 - Lazy init for PropertiesUtil::getProperties
Signed-off-by: Matt Sicker <[email protected]>
---
.../src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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 b66e60d3c3..f891ded88d 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
@@ -50,7 +50,8 @@ public final class PropertiesUtil {
private static final String LOG4J_PROPERTIES_FILE_NAME =
"log4j2.component.properties";
private static final String LOG4J_SYSTEM_PROPERTIES_FILE_NAME =
"log4j2.system.properties";
- private static final PropertiesUtil LOG4J_PROPERTIES = new
PropertiesUtil(LOG4J_PROPERTIES_FILE_NAME);
+ private static final LazyValue<PropertiesUtil> COMPONENT_PROPERTIES =
+ LazyValue.from(() -> new
PropertiesUtil(LOG4J_PROPERTIES_FILE_NAME));
private final Environment environment;
@@ -104,7 +105,7 @@ public final class PropertiesUtil {
* @return the main Log4j PropertiesUtil instance.
*/
public static PropertiesUtil getProperties() {
- return LOG4J_PROPERTIES;
+ return COMPONENT_PROPERTIES.get();
}
/**