Skip to content

Commit

Permalink
ARROW-4180: [Java] Make CI tests use logback.xml
Browse files Browse the repository at this point in the history
- Add a logback.xml for each project with the default log level set to info.
- Set the "verbose" property for git-commit-plugin to false
- quieten output from qos.logback by attaching the NopStatusListener
- Fix a bunch of doc errors in ArrowBuf.java

Author: Pindikura Ravindra <[email protected]>

Closes apache#3449 from pravindra/javalog and squashes the following commits:

d70649d <Pindikura Ravindra> ARROW-4180: Remove info level for maven (it's the default)
076fbd7 <Pindikura Ravindra> ARROW-4180: update README and add an appender
ea3674b <Pindikura Ravindra> ARROW-4180: restore travis.yaml, set info loglevel
c3fec21 <Pindikura Ravindra> ARROW-4180: Fix a typo in ci script
b567651 <Pindikura Ravindra> ARROW-4180: quieten output from logback
fc63176 <Pindikura Ravindra> ARROW-4180: add explicit logback.xml for each project
cc3d496 <Pindikura Ravindra> ARROW-4180:  Make CI tests use logback.xml
  • Loading branch information
Pindikura Ravindra authored and BryanCutler committed Jan 23, 2019
1 parent 085034f commit 95788ce
Show file tree
Hide file tree
Showing 13 changed files with 148 additions and 35 deletions.
2 changes: 0 additions & 2 deletions ci/travis_script_gandiva_java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ JAVA_DIR=${TRAVIS_BUILD_DIR}/java

pushd $JAVA_DIR

export MAVEN_OPTS="$MAVEN_OPTS -Dorg.slf4j.simpleLogger.defaultLogLevel=warn"

# build with gandiva profile
$TRAVIS_MVN -P gandiva -B install -DskipTests -Dgandiva.cpp.build.dir=$CPP_BUILD_DIR/debug

Expand Down
3 changes: 1 addition & 2 deletions ci/travis_script_java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ source $TRAVIS_BUILD_DIR/ci/travis_env_common.sh
JAVA_DIR=${TRAVIS_BUILD_DIR}/java
pushd $JAVA_DIR

export MAVEN_OPTS="$MAVEN_OPTS -Dorg.slf4j.simpleLogger.defaultLogLevel=warn"
if [ $ARROW_TRAVIS_JAVA_BUILD_ONLY == "1" ]; then
if [ "$ARROW_TRAVIS_JAVA_BUILD_ONLY" == "1" ]; then
# Save time and make build less verbose by skipping tests and style checks
$TRAVIS_MVN -DskipTests=true -Dcheckstyle.skip=true -B install
else
Expand Down
14 changes: 5 additions & 9 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,13 @@ Refer to `java/dev/checkstyle/checkstyle.xml for rule specifics.
## 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:
it uses the logback.xml present in the corresponding module's src/test/resources
directory, which has the default log level set to INFO.
Arrow Java can be built with an alternate logback configuration file using the
following command run in the project root directory:

```bash
mvn -Dlogback.configurationFile=file:`pwd`/dev/logback.xml
mvn -Dlogback.configurationFile=file:<path-of-logback-file>
```

See [Logback Configuration][1] for more details.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- 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
Expand All @@ -9,12 +10,8 @@
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>

<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
Expand All @@ -23,7 +20,9 @@ $ mvn -Dlogback.configurationFile=file:${ARROW_HOME}/java/dev/logback.xml test
</encoder>
</appender>

<root level="ERROR">
<logger name="org.apache.arrow" additivity="false">
<level value="info" />
<appender-ref ref="STDOUT" />
</root>
</logger>

</configuration>
3 changes: 2 additions & 1 deletion java/flight/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
language governing permissions and limitations under the License. -->

<configuration>
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
<appender name="SOCKET"
class="de.huxhorn.lilith.logback.appender.ClassicMultiplexSocketAppender">
<Compressing>true</Compressing>
Expand All @@ -24,4 +25,4 @@
<appender-ref ref="FILE" />
</logger>

</configuration>
</configuration>
11 changes: 10 additions & 1 deletion java/gandiva/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@
language governing permissions and limitations under the License. -->

<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>

<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
<logger name="org.apache.arrow" additivity="false">
<level value="info" />
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</logger>

</configuration>
18 changes: 9 additions & 9 deletions java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ protected short _getShort(int index) {
}

/**
* @see {@link #getShortLE(int)}.
* @see ArrowBuf#getShortLE(int).
*/
@Override
protected short _getShortLE(int index) {
Expand All @@ -804,23 +804,23 @@ protected int _getInt(int index) {
}

/**
* @see {@link #getIntLE(int)}.
* @see ArrowBuf#getIntLE(int).
*/
@Override
protected int _getIntLE(int index) {
return getIntLE(index);
}

/**
* @see {@link #getUnsignedMedium(int)}.
* @see ArrowBuf#getUnsignedMedium(int).
*/
@Override
protected int _getUnsignedMedium(int index) {
return getUnsignedMedium(index);
}

/**
* @see {@link #getUnsignedMediumLE(int)}.
* @see ArrowBuf#getUnsignedMediumLE(int).
*/
@Override
protected int _getUnsignedMediumLE(int index) {
Expand All @@ -833,7 +833,7 @@ protected long _getLong(int index) {
}

/**
* @see {@link #getLongLE(int)}.
* @see ArrowBuf#getLongLE(int).
*/
@Override
protected long _getLongLE(int index) {
Expand All @@ -851,7 +851,7 @@ protected void _setShort(int index, int value) {
}

/**
* @see {@link #setShortLE(int, int)}.
* @see ArrowBuf#setShortLE(int, int).
*/
@Override
protected void _setShortLE(int index, int value) {
Expand All @@ -864,7 +864,7 @@ protected void _setMedium(int index, int value) {
}

/**
* @see {@link #setMediumLE(int, int)}.
* @see ArrowBuf#setMediumLE(int, int).
*/
@Override
protected void _setMediumLE(int index, int value) {
Expand All @@ -877,7 +877,7 @@ protected void _setInt(int index, int value) {
}

/**
* @see {@link #setIntLE(int, int)}.
* @see ArrowBuf#setIntLE(int, int).
*/
@Override
protected void _setIntLE(int index, int value) {
Expand All @@ -890,7 +890,7 @@ protected void _setLong(int index, long value) {
}

/**
* @see {@link #setLongLE(int, long)}.
* @see ArrowBuf#setLongLE(int, long).
*/
@Override
public void _setLongLE(int index, long value) {
Expand Down
28 changes: 28 additions & 0 deletions java/memory/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- 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. -->

<configuration>
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
<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>

<logger name="org.apache.arrow" additivity="false">
<level value="info" />
<appender-ref ref="STDOUT" />
</logger>

</configuration>
28 changes: 28 additions & 0 deletions java/plasma/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- 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. -->

<configuration>
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
<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>

<logger name="org.apache.arrow" additivity="false">
<level value="info" />
<appender-ref ref="STDOUT" />
</logger>

</configuration>
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@

<configuration>
<dateFormat>dd.MM.yyyy '@' HH:mm:ss z</dateFormat>
<verbose>true</verbose>
<verbose>false</verbose>
<skipPoms>false</skipPoms>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
Expand Down
27 changes: 27 additions & 0 deletions java/tools/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- 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. -->

<configuration>
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
<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>
<logger name="org.apache.arrow" additivity="false">
<level value="info" />
<appender-ref ref="STDOUT" />
</logger>

</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ public static RollbackCloseable rollbackable(AutoCloseable... closeables) {
}

/**
* close() an {@see java.lang.AutoCloseable} without throwing a (checked)
* {@see java.lang.Exception}. This wraps the close() call with a
* close() an {@link java.lang.AutoCloseable} without throwing a (checked)
* {@link java.lang.Exception}. This wraps the close() call with a
* try-catch that will rethrow an Exception wrapped with a
* {@see java.lang.RuntimeException}, providing a way to call close()
* {@link java.lang.RuntimeException}, providing a way to call close()
* without having to do the try-catch everywhere or propagate the Exception.
*
* @param autoCloseable the AutoCloseable to close; may be null
Expand Down
28 changes: 28 additions & 0 deletions java/vector/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- 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. -->

<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>

<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
<logger name="org.apache.arrow" additivity="false">
<level value="info" />
<appender-ref ref="STDOUT" />
</logger>

</configuration>

0 comments on commit 95788ce

Please sign in to comment.