Skip to content

Commit

Permalink
move to
Browse files Browse the repository at this point in the history
  • Loading branch information
witgo committed Apr 6, 2014
1 parent f447f50 commit edd9630
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
3 changes: 3 additions & 0 deletions core/src/main/scala/org/apache/spark/Logging.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.apache.spark
import org.apache.log4j.{LogManager, PropertyConfigurator}
import org.slf4j.{Logger, LoggerFactory}
import org.slf4j.impl.StaticLoggerBinder
import org.slf4j.bridge.SLF4JBridgeHandler

/**
* Utility trait for classes that want to log data. Creates a SLF4J logger for the class and allows
Expand Down Expand Up @@ -128,4 +129,6 @@ trait Logging {
private object Logging {
@volatile private var initialized = false
val initLock = new Object()
SLF4JBridgeHandler.removeHandlersForRootLogger()
SLF4JBridgeHandler.install()
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,32 +81,14 @@ private[sql] case class ParquetRelation(val path: String)

private[sql] object ParquetRelation {

@volatile private var enabledLogForwarding = false
val initLock = new Object()

def enableLogForwarding() {
// Note: Parquet does not use forwarding to parent loggers which
// is required for the JUL-SLF4J bridge to work. Also there is
// a default logger that appends to Console which needs to be
// reset.
if (!enabledLogForwarding) {
initLock.synchronized {
if (!enabledLogForwarding) {
import org.slf4j.bridge.SLF4JBridgeHandler
import java.util.logging.Logger
import java.util.logging.LogManager

if (!SLF4JBridgeHandler.isInstalled){
LogManager.getLogManager.reset()
SLF4JBridgeHandler.install()
}
val parquetLogger = Logger.getLogger("parquet")
parquetLogger.getHandlers.foreach(parquetLogger.removeHandler)
parquetLogger.addHandler(new SLF4JBridgeHandler())
enabledLogForwarding = true
}
}
}
val parquetLogger = java.util.logging.Logger.getLogger("parquet")
parquetLogger.getHandlers.foreach(parquetLogger.removeHandler)
if(parquetLogger.getLevel != null) parquetLogger.setLevel(null)
}

// The element type for the RDDs that this relation maps to.
Expand Down

0 comments on commit edd9630

Please sign in to comment.