You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gobblin.apache.org by ab...@apache.org on 2017/12/05 22:35:26 UTC
incubator-gobblin git commit: Make log4j config work for running
tests in cluster module in Intellij
Repository: incubator-gobblin
Updated Branches:
refs/heads/master f01939657 -> 571746c2b
Make log4j config work for running tests in cluster module in Intellij
Issue:
When running unit tests in the cluster module, the
log4j output is very
noisy and it makes seeing the errors more
difficult.
There is a log4j.properties file in the test
resource directory. But
it doesn't take effect when running these tests in
Intellij.
Analysis:
When running unit tests inside the IDE, it appears
that intellij will add the dependent module’s test
classes and resources in the class path.
e.g.
/Users/userA/oss/gobblin/build/gobblin-
cluster/classes/test
/Users/userA/oss/gobblin/build/gobblin-
cluster/classes/main
/Users/userA/oss/gobblin/build/gobblin-
api/classes/test
/Users/userA/oss/gobblin/build/gobblin-
api/classes/main
It appears to be as designed according to this
issue and only affects
gradle based projects.
https://youtrack.jetbrains.com/issue/IDEA-24680
As the result it uses the log4j config at
/Users/userA/oss/gobblin/gobblin-
runtime/src/test/resources/log4j.xml instead of
the one in /Users/userA/oss/gobblin/gobblin-
runtime/src/test/resources/log4j.properties since
.xml config takes precedence.
After removing the log4j.xml from runtime test
resource, it tries to load
log4j: Using URL [jar:file:/Users/userA/.gradle/ca
ches/modules-2/files-2.1/com.linkedin.pegasus/gene
rator/11.0.0/e83ba8b8b7e5efabb12f6e2ea3eedf45caacf
7a4/generator-11.0.0.jar!/log4j.xml] for automatic
log4j configuration.
Fix:
Change the log4j.properties in this module to
log4j.xml so that it is
picked up.
Also change the default level from info to warn to
reduce the noise.
Closes #2188 from HappyRay/fix-log4j-config-in-
tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/commit/571746c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/tree/571746c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/diff/571746c2
Branch: refs/heads/master
Commit: 571746c2be3b70de38b29af2461d71d83e9ba77b
Parents: f019396
Author: Ray Yang <ru...@gmail.com>
Authored: Tue Dec 5 14:35:20 2017 -0800
Committer: Abhishek Tiwari <ab...@gmail.com>
Committed: Tue Dec 5 14:35:20 2017 -0800
----------------------------------------------------------------------
.../src/test/resources/log4j.properties | 31 ---------------
gobblin-cluster/src/test/resources/log4j.xml | 40 ++++++++++++++++++++
2 files changed, 40 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/571746c2/gobblin-cluster/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/gobblin-cluster/src/test/resources/log4j.properties b/gobblin-cluster/src/test/resources/log4j.properties
deleted file mode 100644
index 75384e0..0000000
--- a/gobblin-cluster/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,31 +0,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.
-#
-
-log4j.rootLogger=INFO, 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{yyyy-MM-dd HH:mm:ss z} %-5p [%t] %C %X{tableName} - %m%n
-
-# Suppressed loggers'
-log4j.logger.org.apache.helix.controller.GenericHelixController=ERROR
-log4j.logger.org.apache.helix.controller.stages=ERROR
-log4j.logger.org.apache.helix.controller.strategy.AutoRebalanceStrategy=ERROR
-log4j.logger.org.apache.helix.manager.zk=ERROR
-log4j.logger.org.apache.helix.monitoring.mbeans.ClusterStatusMonitor=ERROR
-log4j.logger.org.apache.helix.store.zk.AutoFallbackPropertyStore=ERROR
-log4j.logger.org.apache.zookeeper.ClientCnxn=ERROR
http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/571746c2/gobblin-cluster/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/gobblin-cluster/src/test/resources/log4j.xml b/gobblin-cluster/src/test/resources/log4j.xml
new file mode 100644
index 0000000..32367af
--- /dev/null
+++ b/gobblin-cluster/src/test/resources/log4j.xml
@@ -0,0 +1,40 @@
+<?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.
+ -->
+
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{yyyy-MM-dd HH:mm:ss z} %-5p [%t] %C %L - %m%n" />
+ </layout>
+ </appender>
+
+ <!--<logger name="org.apache.hadoop.conf.Configuration">-->
+ <!--<level value="FATAL"/>-->
+ <!--</logger>-->
+
+ <root>
+ <level value="warn" />
+ <appender-ref ref="console" />
+ </root>
+
+
+</log4j:configuration>