jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/349919 )
Change subject: moving all logging to logback
......................................................................
moving all logging to logback
Multiple logging framework were used at runtime (log4j, logback, ...). The
configuration is now cleaned up, with only logback as a runtime framework.
jcl-over-slf4j, jul-to-slf4j and log4j-to-slf4j are used to direct all logging
to slf4j and then logback.
logback-test.xml has been added to all modules that have tests. logback.xml
has been added to the final war to configure production logging. This can
still be overriden if necessary with -Dlogback.configurationFile system
property.
Note that this change is likely to modify the logging behaviour.
Change-Id: I69c270c71252fa2cbae40d150c0204e4ac92817a
---
D blazegraph/src/test/resources/log4j.properties
A blazegraph/src/test/resources/logback-test.xml
M common/pom.xml
A common/src/test/resources/logback-test.xml
M pom.xml
M tools/src/main/resources/logback-verbose.xml
M tools/src/main/resources/logback.xml
M tools/src/test/resources/logback-test.xml
M war/pom.xml
A war/src/main/resources/logback.xml
10 files changed, 192 insertions(+), 28 deletions(-)
Approvals:
Smalyshev: Looks good to me, approved
jenkins-bot: Verified
diff --git a/blazegraph/src/test/resources/log4j.properties
b/blazegraph/src/test/resources/log4j.properties
deleted file mode 100644
index 9c13c52..0000000
--- a/blazegraph/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-log4j.rootLogger=WARN, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
diff --git a/blazegraph/src/test/resources/logback-test.xml
b/blazegraph/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..e76c65b
--- /dev/null
+++ b/blazegraph/src/test/resources/logback-test.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
%msg%n</pattern>
+ <outputPatternAsHeader>true</outputPatternAsHeader>
+ </encoder>
+ </appender>
+
+ <logger name="org.wikidata.query.rdf" level="info"/>
+ <logger name="org.wikidata.query.rdf.tool.wikibase" level="debug"/>
+
+ <root level="info">
+ <appender-ref ref="STDOUT"/>
+ </root>
+</configuration>
diff --git a/common/pom.xml b/common/pom.xml
index 92efc25..55c41eb 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -20,6 +20,12 @@
<dependencies>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <!-- this should be a test scoped dependency, but randomizedtesting does
some strange things with classpath -->
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<scope>test</scope>
diff --git a/common/src/test/resources/logback-test.xml
b/common/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..17370c8
--- /dev/null
+++ b/common/src/test/resources/logback-test.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
%msg%n</pattern>
+ <outputPatternAsHeader>true</outputPatternAsHeader>
+ </encoder>
+ </appender>
+
+ <logger name="org.wikidata.query.rdf" level="info"/>
+ <logger name="org.wikidata.query.rdf.tool.wikibase" level="debug"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+</configuration>
diff --git a/pom.xml b/pom.xml
index c0b2004..ec6a225 100644
--- a/pom.xml
+++ b/pom.xml
@@ -94,11 +94,23 @@
<groupId>com.blazegraph</groupId>
<artifactId>bigdata-cache</artifactId>
<version>${blazegraph.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.blazegraph</groupId>
<artifactId>bigdata-client</artifactId>
<version>${blazegraph.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.blazegraph</groupId>
@@ -108,6 +120,10 @@
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -120,18 +136,46 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.blazegraph</groupId>
<artifactId>bigdata-util</artifactId>
<version>${blazegraph.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.blazegraph</groupId>
<artifactId>bigdata-war</artifactId>
<version>${blazegraph.version}</version>
<type>war</type>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.blazegraph</groupId>
@@ -139,6 +183,14 @@
<version>${blazegraph.version}</version>
<type>pom</type>
<exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
@@ -149,6 +201,12 @@
<groupId>com.blazegraph</groupId>
<artifactId>ctc-striterators</artifactId>
<version>${blazegraph.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
@@ -221,6 +279,16 @@
<groupId>org.apache.jena</groupId>
<artifactId>jena-core</artifactId>
<version>2.13.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@@ -274,6 +342,14 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -324,6 +400,16 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
+ <artifactId>jul-to-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
diff --git a/tools/src/main/resources/logback-verbose.xml
b/tools/src/main/resources/logback-verbose.xml
index 4d4a3de..9c6ee89 100644
--- a/tools/src/main/resources/logback-verbose.xml
+++ b/tools/src/main/resources/logback-verbose.xml
@@ -1,12 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
%msg%n</pattern>
+ <outputPatternAsHeader>true</outputPatternAsHeader>
</encoder>
</appender>
+ <logger name="org.wikidata.query.rdf" level="debug"/>
+
<root level="warn">
- <appender-ref ref="STDOUT" />
+ <appender-ref ref="STDOUT"/>
</root>
- <logger name="org.wikidata.query.rdf" level="debug" />
</configuration>
diff --git a/tools/src/main/resources/logback.xml
b/tools/src/main/resources/logback.xml
index df2b94a..206a188 100644
--- a/tools/src/main/resources/logback.xml
+++ b/tools/src/main/resources/logback.xml
@@ -1,12 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
%msg%n</pattern>
- </encoder>
- </appender>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
%msg%n</pattern>
+ <outputPatternAsHeader>true</outputPatternAsHeader>
+ </encoder>
+ </appender>
- <root level="warn">
- <appender-ref ref="STDOUT" />
- </root>
- <logger name="org.wikidata.query.rdf" level="info" />
+ <logger name="org.wikidata.query.rdf" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
</configuration>
diff --git a/tools/src/test/resources/logback-test.xml
b/tools/src/test/resources/logback-test.xml
index a969208..17370c8 100644
--- a/tools/src/test/resources/logback-test.xml
+++ b/tools/src/test/resources/logback-test.xml
@@ -1,13 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
%msg%n</pattern>
- </encoder>
- </appender>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
%msg%n</pattern>
+ <outputPatternAsHeader>true</outputPatternAsHeader>
+ </encoder>
+ </appender>
- <root level="warn">
- <appender-ref ref="STDOUT" />
- </root>
- <logger name="org.wikidata.query.rdf" level="info" />
- <logger name="org.wikidata.query.rdf.tool.wikibase" level="debug" />
+ <logger name="org.wikidata.query.rdf" level="info"/>
+ <logger name="org.wikidata.query.rdf.tool.wikibase" level="debug"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
</configuration>
diff --git a/war/pom.xml b/war/pom.xml
index 0d91a08..44a4434 100644
--- a/war/pom.xml
+++ b/war/pom.xml
@@ -21,10 +21,16 @@
<dependencies>
<dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>com.blazegraph</groupId>
<artifactId>bigdata-war</artifactId>
<type>war</type>
<scope>runtime</scope>
+ <exclusions></exclusions>
</dependency>
<!-- include bigdata-war as a pom dependency to collect its transitive
dependencies -->
<dependency>
@@ -45,6 +51,21 @@
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jul-to-slf4j</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>org.wikidata.query.rdf</groupId>
<artifactId>blazegraph</artifactId>
<scope>runtime</scope>
diff --git a/war/src/main/resources/logback.xml
b/war/src/main/resources/logback.xml
new file mode 100644
index 0000000..17370c8
--- /dev/null
+++ b/war/src/main/resources/logback.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
%msg%n</pattern>
+ <outputPatternAsHeader>true</outputPatternAsHeader>
+ </encoder>
+ </appender>
+
+ <logger name="org.wikidata.query.rdf" level="info"/>
+ <logger name="org.wikidata.query.rdf.tool.wikibase" level="debug"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+</configuration>
--
To view, visit https://gerrit.wikimedia.org/r/349919
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I69c270c71252fa2cbae40d150c0204e4ac92817a
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/rdf
Gerrit-Branch: master
Gerrit-Owner: Gehel <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits