You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ic...@apache.org on 2018/08/24 14:11:48 UTC
[arrow] branch master updated: ARROW-3111: [Java] Adding logback
config file to allow running tests with different log level
This is an automated email from the ASF dual-hosted git repository.
icexelloss pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 65a391a ARROW-3111: [Java] Adding logback config file to allow running tests with different log level
65a391a is described below
commit 65a391a948ea8e8b1d418ce843ca645ff0a19092
Author: Bryan Cutler <cu...@gmail.com>
AuthorDate: Fri Aug 24 14:09:14 2018 +0000
ARROW-3111: [Java] Adding logback config file to allow running tests with different log level
Java uses the logback logger when running test, which has a default level of DEBUG. To change the level, an XML config file is needed. This adds a config file with level of ERROR. This config file is not used automatically and it's location needs to be specified. One way to specify this via command line is: `mvn -Dlogback.configurationFile=file:${ARROW_HOME}/java/dev/logback.xml`.
Author: Bryan Cutler <cu...@gmail.com>
Closes #2465 from BryanCutler/java-adding-logback-config-ARROW-3111 and squashes the following commits:
04223d35 <Bryan Cutler> fixed Logback case
d53802e7 <Bryan Cutler> added readme instructions
e20fbb11 <Bryan Cutler> forgot test in example cmd
c06c37a1 <Bryan Cutler> Adding logback config file
---
java/README.md | 20 ++++++++++++++++++++
java/dev/logback.xml | 29 +++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/java/README.md b/java/README.md
index dd4f924..3de8eb1 100644
--- a/java/README.md
+++ b/java/README.md
@@ -31,3 +31,23 @@ install:
cd java
mvn install
```
+
+## Test Logging Configuration
+
+When running tests, Arrow Java uses the Logback logger with SLF4J. By default,
+Logback has a log level set to DEBUG. Besides setting this level
+programmatically, it can also be configured with a file named either
+"logback.xml" or "logback-test.xml" residing in the classpath. The file
+location can also be specified in the Maven command line with the following
+option `-Dlogback.configurationFile=file:<absolute-file-path>`. A sample
+logback.xml file is available in `java/dev` with a log level of ERROR. Arrow
+Java can be built with this file using the following command run in the project
+root directory:
+
+```bash
+mvn -Dlogback.configurationFile=file:`pwd`/dev/logback.xml
+```
+
+See [Logback Configuration][1] for more details.
+
+[1]: https://logback.qos.ch/manual/configuration.html
diff --git a/java/dev/logback.xml b/java/dev/logback.xml
new file mode 100644
index 0000000..10d5480
--- /dev/null
+++ b/java/dev/logback.xml
@@ -0,0 +1,29 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ You under the Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain a copy of
+ the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+ by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific
+ language governing permissions and limitations under the License. -->
+
+<!-- This can be used when running tests with Maven by specifying the following option:
+$ mvn -Dlogback.configurationFile=file:${ARROW_HOME}/java/dev/logback.xml test
+-->
+
+<configuration>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="ERROR">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>