[PATCH 2 of 3] Rely on log4j's default initialization procedure

Wald Commits scm-commit at wald.intevation.org
Fri Feb 25 17:19:42 CET 2022


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1645797683 -3600
#      Fri Feb 25 15:01:23 2022 +0100
# Branch 3.2.x
# Node ID 5cd1c627cda9b2c8ae50b27586785fee67540aea
# Parent  48d14cf857dbb73ab8bf799a033db40aa6ee4e05
Rely on log4j's default initialization procedure

This should make upgrading to Log4j 2.x easier.
In passing, use latest Log4j 1.

diff -r 48d14cf857db -r 5cd1c627cda9 artifact-database/pom.xml
--- a/artifact-database/pom.xml	Fri Feb 25 14:53:32 2022 +0100
+++ b/artifact-database/pom.xml	Fri Feb 25 15:01:23 2022 +0100
@@ -74,17 +74,7 @@
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
-      <version>1.2.14</version>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>jul-to-slf4j</artifactId>
-      <version>1.6.1</version>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <version>1.6.1</version>
+      <version>1.2.17</version>
     </dependency>
     <dependency>
         <groupId>org.mortbay.jetty</groupId>
diff -r 48d14cf857db -r 5cd1c627cda9 artifact-database/src/main/java/org/dive4elements/artifactdatabase/App.java
--- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/App.java	Fri Feb 25 14:53:32 2022 +0100
+++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/App.java	Fri Feb 25 15:01:23 2022 +0100
@@ -8,17 +8,8 @@
 
 package org.dive4elements.artifactdatabase;
 
-import org.dive4elements.artifacts.common.utils.Config;
-
 import org.dive4elements.artifactdatabase.rest.HTTPServer;
 
-import java.io.File;
-
-import java.net.MalformedURLException;
-
-import org.apache.log4j.PropertyConfigurator;
-
-import org.slf4j.bridge.SLF4JBridgeHandler;
 
 /**
  * Starting point of the artifact database.
@@ -28,38 +19,11 @@
 public class App
 {
     /**
-     * The logging is done via Log4j. To configure the logging
-     * a file 'log4j.properties' is search in the configuration directory.
-     */
-    public static final String LOG4J_PROPERTIES =
-        "log4j.properties";
-
-    /**
-     * Trys to load the Log4j configuration from ${config.dir}/log4j.properties.
-     */
-    public static final void configureLogging() {
-        File configDir = Config.getConfigDirectory();
-        File propFile = new File(configDir, LOG4J_PROPERTIES);
-
-        if (propFile.isFile() && propFile.canRead()) {
-            try {
-                PropertyConfigurator.configure(propFile.toURI().toURL());
-                SLF4JBridgeHandler.install();
-            }
-            catch (MalformedURLException mue) {
-                mue.printStackTrace(System.err);
-            }
-        }
-    }
-
-    /**
      * Starts the artifact database.
      * @param args The commandline arguments. Unused.
      */
     public static void main(String[] args) {
 
-        configureLogging();
-
         FactoryBootstrap bootstrap = new FactoryBootstrap();
 
         bootstrap.boot();
diff -r 48d14cf857db -r 5cd1c627cda9 artifacts-common/pom.xml
--- a/artifacts-common/pom.xml	Fri Feb 25 14:53:32 2022 +0100
+++ b/artifacts-common/pom.xml	Fri Feb 25 15:01:23 2022 +0100
@@ -24,7 +24,7 @@
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
-      <version>1.2.14</version>
+      <version>1.2.17</version>
     </dependency>
     <dependency>
       <groupId>commons-codec</groupId>


More information about the Dive4Elements-commits mailing list