You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by pw...@apache.org on 2014/01/08 00:49:23 UTC
[1/2] git commit: Add log4j exclusion rule to maven.
Updated Branches:
refs/heads/master 7d5fa175c -> 6ccf8ce70
Add log4j exclusion rule to maven.
To make this work I had to rename the defaults file. Otherwise
maven's pattern matching rules included it when trying to match
other log4j.properties files.
I also fixed a bug in the existing maven build where two
<transformers> tags were present in assembly/pom.xml
such that one overwrote the other.
Project: http://git-wip-us.apache.org/repos/asf/incubator-spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spark/commit/e688e112
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spark/tree/e688e112
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spark/diff/e688e112
Branch: refs/heads/master
Commit: e688e11206401850a13a87d7db52941cc716f88a
Parents: 15d9534
Author: Patrick Wendell <pw...@gmail.com>
Authored: Tue Jan 7 12:42:19 2014 -0800
Committer: Patrick Wendell <pw...@gmail.com>
Committed: Tue Jan 7 12:56:24 2014 -0800
----------------------------------------------------------------------
assembly/pom.xml | 6 +++---
.../resources/org/apache/spark/default-log4j.properties | 8 --------
.../resources/org/apache/spark/log4j-defaults.properties | 8 ++++++++
core/src/main/scala/org/apache/spark/Logging.scala | 10 ++++++----
examples/pom.xml | 3 +++
5 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/e688e112/assembly/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/pom.xml b/assembly/pom.xml
index 9b70812..54a2591 100644
--- a/assembly/pom.xml
+++ b/assembly/pom.xml
@@ -108,12 +108,12 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/org.apache.hadoop.fs.FileSystem</resource>
</transformer>
- </transformers>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
+ <resource>log4j.properties</resource>
+ </transformer>
</transformers>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/e688e112/core/src/main/resources/org/apache/spark/default-log4j.properties
----------------------------------------------------------------------
diff --git a/core/src/main/resources/org/apache/spark/default-log4j.properties b/core/src/main/resources/org/apache/spark/default-log4j.properties
deleted file mode 100644
index d72dbad..0000000
--- a/core/src/main/resources/org/apache/spark/default-log4j.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-# Set everything to be logged to the console
-log4j.rootCategory=INFO, console
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n
-
-# Ignore messages below warning level from Jetty, because it's a bit verbose
-log4j.logger.org.eclipse.jetty=WARN
http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/e688e112/core/src/main/resources/org/apache/spark/log4j-defaults.properties
----------------------------------------------------------------------
diff --git a/core/src/main/resources/org/apache/spark/log4j-defaults.properties b/core/src/main/resources/org/apache/spark/log4j-defaults.properties
new file mode 100644
index 0000000..d72dbad
--- /dev/null
+++ b/core/src/main/resources/org/apache/spark/log4j-defaults.properties
@@ -0,0 +1,8 @@
+# Set everything to be logged to the console
+log4j.rootCategory=INFO, console
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n
+
+# Ignore messages below warning level from Jetty, because it's a bit verbose
+log4j.logger.org.eclipse.jetty=WARN
http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/e688e112/core/src/main/scala/org/apache/spark/Logging.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/Logging.scala b/core/src/main/scala/org/apache/spark/Logging.scala
index d519fc5..4a34989 100644
--- a/core/src/main/scala/org/apache/spark/Logging.scala
+++ b/core/src/main/scala/org/apache/spark/Logging.scala
@@ -104,13 +104,15 @@ trait Logging {
// If Log4j doesn't seem initialized, load a default properties file
val log4jInitialized = LogManager.getRootLogger.getAllAppenders.hasMoreElements
if (!log4jInitialized) {
- val defaultLogProps = "org/apache/spark/default-log4j.properties"
+ val defaultLogProps = "org/apache/spark/log4j-defaults.properties"
val classLoader = this.getClass.getClassLoader
Option(classLoader.getResource(defaultLogProps)) match {
- case Some(url) => PropertyConfigurator.configure(url)
- case None => System.err.println(s"Spark was unable to load $defaultLogProps")
+ case Some(url) =>
+ PropertyConfigurator.configure(url)
+ log.info(s"Using Spark's default log4j profile: $defaultLogProps")
+ case None =>
+ System.err.println(s"Spark was unable to load $defaultLogProps")
}
- log.info(s"Using Spark's default log4j profile: $defaultLogProps")
}
Logging.initialized = true
http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/e688e112/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 7a7032c..7e41bef 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -203,6 +203,9 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
+ <resource>log4j.properties</resource>
+ </transformer>
</transformers>
</configuration>
</execution>
[2/2] git commit: Merge pull request #351 from pwendell/maven-fix
Posted by pw...@apache.org.
Merge pull request #351 from pwendell/maven-fix
Add log4j exclusion rule to maven.
To make this work I had to rename the defaults file. Otherwise
maven's pattern matching rules included it when trying to match
other log4j.properties files.
I also fixed a bug in the existing maven build where two
<transformers> tags were present in assembly/pom.xml
such that one overwrote the other.
Project: http://git-wip-us.apache.org/repos/asf/incubator-spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spark/commit/6ccf8ce7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spark/tree/6ccf8ce7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spark/diff/6ccf8ce7
Branch: refs/heads/master
Commit: 6ccf8ce705f13b5c6993675ee034db64363caa31
Parents: 7d5fa17 e688e11
Author: Patrick Wendell <pw...@gmail.com>
Authored: Tue Jan 7 15:49:14 2014 -0800
Committer: Patrick Wendell <pw...@gmail.com>
Committed: Tue Jan 7 15:49:14 2014 -0800
----------------------------------------------------------------------
assembly/pom.xml | 6 +++---
.../resources/org/apache/spark/default-log4j.properties | 8 --------
.../resources/org/apache/spark/log4j-defaults.properties | 8 ++++++++
core/src/main/scala/org/apache/spark/Logging.scala | 10 ++++++----
examples/pom.xml | 3 +++
5 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------