You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2020/10/15 08:53:01 UTC

[jackrabbit-filevault] 01/01: JCRVLT-475 reduce logging verbosity

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/JCRVLT-475-enable-sonarcloud
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git

commit 9361f076143f41a025e73a04b0c0785716bbd868
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Oct 15 09:43:33 2020 +0200

    JCRVLT-475 reduce logging verbosity
---
 .travis.yml                                        |  5 +++-
 vault-core/pom.xml                                 | 12 ++------
 .../packaging/integration/IntegrationTestBase.java | 10 +++++--
 .../packaging/integration/TestSubPackages.java     |  3 +-
 .../src/test/resources/logback-only-errors.xml     | 34 ++++++++++++++++++++++
 5 files changed, 50 insertions(+), 14 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 5e017aa..e430531 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -71,7 +71,10 @@ script:
   # Just an example. Do what you deem useful
   - mvn verify -B
 after_success:
-  - if [ "$POST_COVERAGE" == "true" ]; then mvn -Pjacoco-report clean verify sonar:sonar -Dsonar.projectKey=apache_jackrabbit-filevault; fi
+  - | 
+    if [ "$POST_COVERAGE" == "true" ]; then 
+      mvn -Pjacoco-report clean verify sonar:sonar -Dsonar.projectKey=apache_jackrabbit-filevault -Dlogback.configurationFile=vault-core/src/test/resources/logback-only-errors.xml
+    fi
 # If you use Gradle, cleanup the build cache from lock/temporary files
 before_cache:
   #- curl "${GRAVIS}.clean_gradle_cache.sh" --output ~/.clean_gradle_cache.sh
diff --git a/vault-core/pom.xml b/vault-core/pom.xml
index 73be5c7..b15e812 100644
--- a/vault-core/pom.xml
+++ b/vault-core/pom.xml
@@ -154,12 +154,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-            <version>1.0.13</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
             <scope>provided</scope>
@@ -208,9 +202,9 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-            <version>${slf4j.version}</version>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>1.0.13</version>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/IntegrationTestBase.java b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/IntegrationTestBase.java
index 9d894d5..35e1130 100644
--- a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/IntegrationTestBase.java
+++ b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/IntegrationTestBase.java
@@ -447,7 +447,12 @@ public class IntegrationTestBase  {
 
     public ImportOptions getDefaultOptions() {
         ImportOptions opts = new ImportOptions();
-        opts.setListener(new ProgressTrackerListener() {
+        opts.setListener(getLoggingProgressTrackerListener());
+        return opts;
+    }
+
+    public ProgressTrackerListener getLoggingProgressTrackerListener() {
+        return new ProgressTrackerListener() {
             public void onMessage(Mode mode, String action, String path) {
                 log.info("{} {}", action, path);
             }
@@ -455,8 +460,7 @@ public class IntegrationTestBase  {
             public void onError(Mode mode, String path, Exception e) {
                 log.info("E {} {}", path, e.toString());
             }
-        });
-        return opts;
+        };
     }
 
     /**
diff --git a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
index e0d277c..87abfcb 100644
--- a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
+++ b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
@@ -672,7 +672,8 @@ public class TestSubPackages extends IntegrationTestBase {
 
         // create new package
         JcrPackage pkg = packMgr.open(PACKAGE_ID_SUB_TEST);
-        packMgr.assemble(pkg, new DefaultProgressListener());
+        //
+        packMgr.assemble(pkg, getLoggingProgressTrackerListener());
 
         try (ZipInputStream in = new ZipInputStream(pkg.getData().getBinary().getStream())) {
             ZipEntry e;
diff --git a/vault-core/src/test/resources/logback-only-errors.xml b/vault-core/src/test/resources/logback-only-errors.xml
new file mode 100644
index 0000000..3b142e3
--- /dev/null
+++ b/vault-core/src/test/resources/logback-only-errors.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?><!--
+  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">
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+    </encoder>
+    <!-- limit logging to not exceed Travis CI maximum log length -->
+    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+      <level>ERROR</level>
+    </filter>
+  </appender>
+
+  <logger name="org.apache.jackrabbit.oak.query.QueryImpl" level="WARN"/>
+  <logger name="org.apache.jackrabbit.oak.plugins.index.IndexUpdate" level="WARN" />
+
+  <root level="INFO">
+    <appender-ref ref="STDOUT" />
+  </root>
+</configuration>