Adopts the logger level for the akka log level
Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/d2dd78f2 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/d2dd78f2 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/d2dd78f2 Branch: refs/heads/master Commit: d2dd78f205e06335ee417031507d63d1a6ced165 Parents: 4e197d5 Author: Till Rohrmann <[email protected]> Authored: Tue Jan 20 01:04:02 2015 +0100 Committer: Ufuk Celebi <[email protected]> Committed: Tue Jan 20 20:29:03 2015 +0100 ---------------------------------------------------------------------- .../apache/flink/runtime/akka/AkkaUtils.scala | 28 ++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/d2dd78f2/flink-runtime/src/main/scala/org/apache/flink/runtime/akka/AkkaUtils.scala ---------------------------------------------------------------------- diff --git a/flink-runtime/src/main/scala/org/apache/flink/runtime/akka/AkkaUtils.scala b/flink-runtime/src/main/scala/org/apache/flink/runtime/akka/AkkaUtils.scala index dd44587..79cfeef 100644 --- a/flink-runtime/src/main/scala/org/apache/flink/runtime/akka/AkkaUtils.scala +++ b/flink-runtime/src/main/scala/org/apache/flink/runtime/akka/AkkaUtils.scala @@ -25,10 +25,13 @@ import akka.actor.{ActorSelection, ActorRef, ActorSystem} import akka.pattern.{Patterns, ask => akkaAsk} import com.typesafe.config.{Config, ConfigFactory} import org.apache.flink.configuration.{ConfigConstants, Configuration} +import org.slf4j.LoggerFactory import scala.concurrent.{ExecutionContext, Future, Await} import scala.concurrent.duration._ object AkkaUtils { + val LOG = LoggerFactory.getLogger(AkkaUtils.getClass) + val DEFAULT_TIMEOUT: FiniteDuration = 1 minute val INF_TIMEOUT = 21474835 seconds @@ -186,13 +189,14 @@ object AkkaUtils { } def getDefaultLocalActorSystemConfigString: String = { - """ + val logLevel = getLogLevel + s""" |akka { | daemonic = on | | loggers = ["akka.event.slf4j.Slf4jLogger"] | logger-startup-timeout = 30s - | loglevel = "DEBUG" + | loglevel = ${logLevel} | stdout-loglevel = "WARNING" | jvm-exit-on-fatal-error = off | log-config-on-start = off @@ -206,6 +210,26 @@ object AkkaUtils { """.stripMargin } + def getLogLevel: String = { + if(LOG.isDebugEnabled) { + "DEBUG" + } else { + if (LOG.isInfoEnabled) { + "INFO" + } else { + if(LOG.isWarnEnabled){ + "WARNING" + } else { + if (LOG.isErrorEnabled) { + "ERROR" + } else { + "OFF" + } + } + } + } + } + def getDefaultActorSystemConfig = { ConfigFactory.parseString(getDefaultActorSystemConfigString) }
