From 7e3301dc9638f5f134a0c70d2c8df95c05c0369d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bone=CC=81r?= Date: Fri, 1 Apr 2011 15:49:33 +0200 Subject: [PATCH] Changed logging level in ReflectiveAccess and set the default Akka log level to INFO --- .../scala/akka/util/ReflectiveAccess.scala | 63 +++++++++---------- config/akka-reference.conf | 2 +- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala index 41d1106818..f4ceba6ebe 100644 --- a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala +++ b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala @@ -6,7 +6,6 @@ package akka.util import akka.dispatch.{Future, CompletableFuture, MessageInvocation} import akka.config.{Config, ModuleNotAvailableException} -import akka.AkkaException import java.net.InetSocketAddress import akka.remoteinterface.RemoteSupport @@ -45,13 +44,13 @@ object ReflectiveAccess { def ensureEnabled = if (!isEnabled) { val e = new ModuleNotAvailableException( "Can't load the remoting module, make sure that akka-remote.jar is on the classpath") - EventHandler.warning(this, e.toString) + EventHandler.debug(this, e.toString) throw e } val remoteSupportClass: Option[Class[_ <: RemoteSupport]] = getClassFor(TRANSPORT) - protected[akka] val defaultRemoteSupport: Option[() => RemoteSupport] = - remoteSupportClass map { remoteClass => + protected[akka] val defaultRemoteSupport: Option[() => RemoteSupport] = + remoteSupportClass map { remoteClass => () => createInstance[RemoteSupport]( remoteClass, Array[Class[_]](), @@ -59,7 +58,7 @@ object ReflectiveAccess { ) getOrElse { val e = new ModuleNotAvailableException( "Can't instantiate [%s] - make sure that akka-remote.jar is on the classpath".format(remoteClass.getName)) - EventHandler.warning(this, e.toString) + EventHandler.debug(this, e.toString) throw e } } @@ -135,7 +134,7 @@ object ReflectiveAccess { Some(ctor.newInstance(args: _*).asInstanceOf[T]) } catch { case e: Exception => - EventHandler.warning(this, e.toString) + EventHandler.debug(this, e.toString) None } @@ -154,7 +153,7 @@ object ReflectiveAccess { } } catch { case e: Exception => - EventHandler.warning(this, e.toString) + EventHandler.debug(this, e.toString) None } @@ -168,7 +167,7 @@ object ReflectiveAccess { } } catch { case e: ExceptionInInitializerError => - EventHandler.warning(this, e.toString) + EventHandler.debug(this, e.toString) throw e } @@ -176,23 +175,23 @@ object ReflectiveAccess { assert(fqn ne null) // First, use the specified CL - val first = try { - Option(classloader.loadClass(fqn).asInstanceOf[Class[T]]) - } catch { - case c: ClassNotFoundException => - EventHandler.warning(this, c.toString) - None - } + val first = try { + Option(classloader.loadClass(fqn).asInstanceOf[Class[T]]) + } catch { + case c: ClassNotFoundException => + EventHandler.debug(this, c.toString) + None + } if (first.isDefined) first - else { + else { // Second option is to use the ContextClassLoader - val second = try { - Option(Thread.currentThread.getContextClassLoader.loadClass(fqn).asInstanceOf[Class[T]]) - } catch { - case c: ClassNotFoundException => - EventHandler.warning(this, c.toString) - None + val second = try { + Option(Thread.currentThread.getContextClassLoader.loadClass(fqn).asInstanceOf[Class[T]]) + } catch { + case c: ClassNotFoundException => + EventHandler.debug(this, c.toString) + None } if (second.isDefined) second @@ -201,22 +200,22 @@ object ReflectiveAccess { // Don't try to use "loader" if we got the default "classloader" parameter if (classloader ne loader) Option(loader.loadClass(fqn).asInstanceOf[Class[T]]) else None - } catch { - case c: ClassNotFoundException => - EventHandler.warning(this, c.toString) - None + } catch { + case c: ClassNotFoundException => + EventHandler.debug(this, c.toString) + None } if (third.isDefined) third else { // Last option is Class.forName - try { + try { Option(Class.forName(fqn).asInstanceOf[Class[T]]) - } catch { - case c: ClassNotFoundException => - EventHandler.warning(this, c.toString) - None - } + } catch { + case c: ClassNotFoundException => + EventHandler.debug(this, c.toString) + None + } } } } diff --git a/config/akka-reference.conf b/config/akka-reference.conf index 1c3676ad31..df2c2c3e0d 100644 --- a/config/akka-reference.conf +++ b/config/akka-reference.conf @@ -13,7 +13,7 @@ akka { time-unit = "seconds" # Time unit for all timeout properties throughout the config event-handlers = ["akka.event.EventHandler$DefaultListener"] # event handlers to register at boot time (EventHandler$DefaultListener logs to STDOUT) - event-handler-level = "DEBUG" # Options: ERROR, WARNING, INFO, DEBUG + event-handler-level = "INFO" # Options: ERROR, WARNING, INFO, DEBUG # These boot classes are loaded (and created) automatically when the Akka Microkernel boots up # Can be used to bootstrap your application(s)