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

pkarwasz 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 e41a62b772 Remove activation detection from `log4j-config-yaml`
e41a62b772 is described below

commit e41a62b772e75221821e9da90983b4c365e7663f
Author: Piotr P. Karwasz <[email protected]>
AuthorDate: Mon Jan 8 11:29:42 2024 +0100

    Remove activation detection from `log4j-config-yaml`
    
    Since `log4j-config-yaml` has a **hard** dependency on
    `jackson-databind-yaml`, we don't need to deal with the possibility of
    that dependency being absent.
---
 .../config/yaml/YamlConfigurationFactory.java      | 31 ----------------------
 1 file changed, 31 deletions(-)

diff --git 
a/log4j-config-yaml/src/main/java/org/apache/logging/log4j/config/yaml/YamlConfigurationFactory.java
 
b/log4j-config-yaml/src/main/java/org/apache/logging/log4j/config/yaml/YamlConfigurationFactory.java
index f10ed2e26c..fc6671ba24 100644
--- 
a/log4j-config-yaml/src/main/java/org/apache/logging/log4j/config/yaml/YamlConfigurationFactory.java
+++ 
b/log4j-config-yaml/src/main/java/org/apache/logging/log4j/config/yaml/YamlConfigurationFactory.java
@@ -21,7 +21,6 @@ import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 import org.apache.logging.log4j.core.config.ConfigurationSource;
 import org.apache.logging.log4j.core.config.Order;
-import org.apache.logging.log4j.core.util.Loader;
 import org.apache.logging.log4j.plugins.Namespace;
 import org.apache.logging.log4j.plugins.Plugin;
 
@@ -35,38 +34,8 @@ public class YamlConfigurationFactory extends 
ConfigurationFactory {
      */
     private static final String[] SUFFIXES = new String[] {".yml", ".yaml"};
 
-    private static final String[] dependencies = new String[] {
-        "com.fasterxml.jackson.databind.ObjectMapper",
-        "com.fasterxml.jackson.databind.JsonNode",
-        "com.fasterxml.jackson.core.JsonParser",
-        "com.fasterxml.jackson.dataformat.yaml.YAMLFactory"
-    };
-
-    private final boolean isActive;
-
-    public YamlConfigurationFactory() {
-        for (final String dependency : dependencies) {
-            if (!Loader.isClassAvailable(dependency)) {
-                LOGGER.debug(
-                        "Missing dependencies for Yaml support, 
ConfigurationFactory {} is inactive",
-                        getClass().getName());
-                isActive = false;
-                return;
-            }
-        }
-        isActive = true;
-    }
-
-    @Override
-    protected boolean isActive() {
-        return isActive;
-    }
-
     @Override
     public Configuration getConfiguration(final LoggerContext loggerContext, 
final ConfigurationSource source) {
-        if (!isActive) {
-            return null;
-        }
         return new YamlConfiguration(loggerContext, source);
     }
 

Reply via email to