[PATCH] Fix logging setup

Wald Commits scm-commit at wald.intevation.org
Mon Oct 10 15:30:21 CEST 2022


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1665408584 -7200
#      Mon Oct 10 15:29:44 2022 +0200
# Branch 3.2.x
# Node ID 432934cda171f4a53ac589920d088c3ef7b0c14c
# Parent  68c6fe74a276894679255d218cbe1a9486b8ab67
Fix logging setup

_ Silence message about missing SLF4J implementation
_ Route java.util.logging to Log4J (at least restlet is affected)
_ Let messages of additional loggers pass to the root loggers appender
  (otherwise, they don't appear at all)

diff -r 68c6fe74a276 -r 432934cda171 artifacts/bin/run.sh
--- a/artifacts/bin/run.sh	Thu Sep 22 16:37:32 2022 +0200
+++ b/artifacts/bin/run.sh	Mon Oct 10 15:29:44 2022 +0200
@@ -21,5 +21,6 @@
      -Dwsplgen.bin.path="$DIR/bin/wsplgen" \
      -Dwsplgen.log.output=false \
      -Dartifact.database.dir="$DIR/conf" \
+     -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager \
      -Dlog4j2.configurationFile="file://$DIR/conf/log4j2.xml" \
      $APP
diff -r 68c6fe74a276 -r 432934cda171 artifacts/doc/conf/log4j2.xml
--- a/artifacts/doc/conf/log4j2.xml	Thu Sep 22 16:37:32 2022 +0200
+++ b/artifacts/doc/conf/log4j2.xml	Mon Oct 10 15:29:44 2022 +0200
@@ -9,9 +9,9 @@
         <Root level="DEBUG">
             <AppenderRef ref="Console"/>
         </Root>
-        <Logger name="org.hibernate" level="WARN" additivity="false"/>
-        <Logger name="net.sf.ehcache" level="WARN" additivity="false"/>
-        <Logger name="org.eclipse" level="WARN" additivity="false"/>
-        <Logger name="org.restlet" level="INFO" additivity="false"/>
+        <Logger name="org.hibernate" level="WARN"/>
+        <Logger name="net.sf.ehcache" level="WARN"/>
+        <Logger name="org.eclipse" level="WARN"/>
+        <Logger name="org.restlet" level="WARN"/>
     </Loggers>
 </Configuration>
diff -r 68c6fe74a276 -r 432934cda171 backend/pom.xml
--- a/backend/pom.xml	Thu Sep 22 16:37:32 2022 +0200
+++ b/backend/pom.xml	Mon Oct 10 15:29:44 2022 +0200
@@ -109,6 +109,18 @@
     </plugins>
   </build>
 
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-bom</artifactId>
+        <version>2.17.1</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
   <dependencies>
     <dependency>
       <groupId>org.dive4elements</groupId>
@@ -139,18 +151,29 @@
       <artifactId>hibernate-jpa-2.0-api</artifactId>
       <version>1.0.1.Final</version>
     </dependency>
+
+    <!-- Logging -->
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-api</artifactId>
-      <version>2.17.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-core</artifactId>
-      <version>2.17.1</version>
       <scope>runtime</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-jul</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+
+    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-dbcp2</artifactId>
       <version>2.1.1</version>


More information about the Dive4Elements-commits mailing list