Skip to content

Commit

Permalink
CR feedback, make the name of the utils function match that in the sp…
Browse files Browse the repository at this point in the history
…ark context for changing the log level and add a note about overriding user-defined log settings.
  • Loading branch information
holdenk committed Sep 23, 2014
1 parent cdb3bfc commit 03ed4f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ class SparkContext(config: SparkConf) extends Logging {
/** A default Hadoop Configuration for the Hadoop code (e.g. file systems) that we reuse. */
val hadoopConfiguration = SparkHadoopUtil.get.newConfiguration(conf)

/** Control our logLevel
/** Control our logLevel. This overrides any user-defined log settings.
* @param logLevel The desired log level as a string.
*/
def setLoggingLevel(logLevel: String) = {
Utils.setLogLevel(org.apache.log4j.Level.toLevel(logLevel))
Utils.setLoggingLevel(org.apache.log4j.Level.toLevel(logLevel))
}
// Optionally log Spark events
private[spark] val eventLogger: Option[EventLoggingListener] = {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ private[spark] object Utils extends Logging {
/**
* configure a new log4j level
*/
def setLogLevel(l: org.apache.log4j.Level) {
def setLoggingLevel(l: org.apache.log4j.Level) {
org.apache.log4j.Logger.getRootLogger().setLevel(l)
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/test/scala/org/apache/spark/util/UtilsSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ class UtilsSuite extends FunSuite with Logging {

// Test for using the util function to change our log levels.
test("log4j log level change") {
Utils.setLogLevel(org.apache.log4j.Level.ALL)
Utils.setLoggingLevel(org.apache.log4j.Level.ALL)
assert(log.isInfoEnabled())
Utils.setLogLevel(org.apache.log4j.Level.ERROR)
Utils.setLoggingLevel(org.apache.log4j.Level.ERROR)
assert(!log.isInfoEnabled())
assert(log.isErrorEnabled())
}
Expand Down

0 comments on commit 03ed4f9

Please sign in to comment.