diff options
author | Patrick Wendell <pwendell@gmail.com> | 2014-08-01 23:55:30 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-08-01 23:55:30 -0700 |
commit | dab37966b0cfd290919ca5c005f59dde00615c0e (patch) | |
tree | ece0def1b321943074f43a6670040c02711604e3 /core | |
parent | adc8303294e26efb4ed15e5f5ba1062f7988625d (diff) | |
download | spark-dab37966b0cfd290919ca5c005f59dde00615c0e.tar.gz spark-dab37966b0cfd290919ca5c005f59dde00615c0e.tar.bz2 spark-dab37966b0cfd290919ca5c005f59dde00615c0e.zip |
Revert "[SPARK-1470][SPARK-1842] Use the scala-logging wrapper instead of the directly sfl4j api"
This reverts commit adc8303294e26efb4ed15e5f5ba1062f7988625d.
Diffstat (limited to 'core')
-rw-r--r-- | core/pom.xml | 4 | ||||
-rw-r--r-- | core/src/main/scala/org/apache/spark/Logging.scala | 39 | ||||
-rw-r--r-- | core/src/main/scala/org/apache/spark/util/SignalLogger.scala | 2 |
3 files changed, 16 insertions, 29 deletions
diff --git a/core/pom.xml b/core/pom.xml index 47766ae5fb..7c60cf10c3 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -99,10 +99,6 @@ <artifactId>jcl-over-slf4j</artifactId> </dependency> <dependency> - <groupId>com.typesafe.scala-logging</groupId> - <artifactId>scala-logging-slf4j_${scala.binary.version}</artifactId> - </dependency> - <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </dependency> diff --git a/core/src/main/scala/org/apache/spark/Logging.scala b/core/src/main/scala/org/apache/spark/Logging.scala index 6e61c00b8d..807ef3e9c9 100644 --- a/core/src/main/scala/org/apache/spark/Logging.scala +++ b/core/src/main/scala/org/apache/spark/Logging.scala @@ -18,9 +18,8 @@ package org.apache.spark import org.apache.log4j.{LogManager, PropertyConfigurator} -import org.slf4j.LoggerFactory +import org.slf4j.{Logger, LoggerFactory} import org.slf4j.impl.StaticLoggerBinder -import com.typesafe.scalalogging.slf4j.Logger import org.apache.spark.annotation.DeveloperApi import org.apache.spark.util.Utils @@ -40,69 +39,61 @@ trait Logging { // be serialized and used on another machine @transient private var log_ : Logger = null - // Method to get the logger name for this object - protected def logName = { - var className = this.getClass.getName - // Ignore trailing $'s in the class names for Scala objects - if (className.endsWith("$")) { - className = className.substring(0, className.length - 1) - } - className - } - // Method to get or create the logger for this object protected def log: Logger = { if (log_ == null) { initializeIfNecessary() - log_ = Logger(LoggerFactory.getLogger(logName)) + var className = this.getClass.getName + // Ignore trailing $'s in the class names for Scala objects + log_ = LoggerFactory.getLogger(className.stripSuffix("$")) } log_ } // Log methods that take only a String protected def logInfo(msg: => String) { - log.info(msg) + if (log.isInfoEnabled) log.info(msg) } protected def logDebug(msg: => String) { - log.debug(msg) + if (log.isDebugEnabled) log.debug(msg) } protected def logTrace(msg: => String) { - log.trace(msg) + if (log.isTraceEnabled) log.trace(msg) } protected def logWarning(msg: => String) { - log.warn(msg) + if (log.isWarnEnabled) log.warn(msg) } protected def logError(msg: => String) { - log.error(msg) + if (log.isErrorEnabled) log.error(msg) } // Log methods that take Throwables (Exceptions/Errors) too protected def logInfo(msg: => String, throwable: Throwable) { - log.info(msg, throwable) + if (log.isInfoEnabled) log.info(msg, throwable) } protected def logDebug(msg: => String, throwable: Throwable) { - log.debug(msg, throwable) + if (log.isDebugEnabled) log.debug(msg, throwable) } protected def logTrace(msg: => String, throwable: Throwable) { - log.trace(msg, throwable) + if (log.isTraceEnabled) log.trace(msg, throwable) } protected def logWarning(msg: => String, throwable: Throwable) { - log.warn(msg, throwable) + if (log.isWarnEnabled) log.warn(msg, throwable) } protected def logError(msg: => String, throwable: Throwable) { - log.error(msg, throwable) + if (log.isErrorEnabled) log.error(msg, throwable) } protected def isTraceEnabled(): Boolean = { - log.underlying.isTraceEnabled + log.isTraceEnabled } private def initializeIfNecessary() { diff --git a/core/src/main/scala/org/apache/spark/util/SignalLogger.scala b/core/src/main/scala/org/apache/spark/util/SignalLogger.scala index e84a6b951f..f77488ef3d 100644 --- a/core/src/main/scala/org/apache/spark/util/SignalLogger.scala +++ b/core/src/main/scala/org/apache/spark/util/SignalLogger.scala @@ -18,7 +18,7 @@ package org.apache.spark.util import org.apache.commons.lang3.SystemUtils -import com.typesafe.scalalogging.slf4j.Logger +import org.slf4j.Logger import sun.misc.{Signal, SignalHandler} /** |