changeset 9750:432934cda171 3.2.x

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)
author Tom Gottfried <tom@intevation.de>
date Mon, 10 Oct 2022 15:29:44 +0200
parents 68c6fe74a276
children 308a0d822d18
files artifacts/bin/run.sh artifacts/doc/conf/log4j2.xml backend/pom.xml
diffstat 3 files changed, 30 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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>
--- 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>

http://dive4elements.wald.intevation.org