diff --git a/akka-actor/src/main/scala/akka/actor/Actor.scala b/akka-actor/src/main/scala/akka/actor/Actor.scala index 1864bc62ef..202b48fa36 100644 --- a/akka-actor/src/main/scala/akka/actor/Actor.scala +++ b/akka-actor/src/main/scala/akka/actor/Actor.scala @@ -358,7 +358,7 @@ trait Actor extends Logging { * log.slf4j.info("got a 'OneWay' message") * * case unknown => - * log.slf4j.warn("unknown message [%s], ignoring", unknown) + * log.slf4j.warn("unknown message [{}], ignoring", unknown) * } * */ diff --git a/akka-actor/src/main/scala/akka/actor/ActorRef.scala b/akka-actor/src/main/scala/akka/actor/ActorRef.scala index 786f996c8c..8d0bbed6af 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorRef.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorRef.scala @@ -578,7 +578,7 @@ trait ActorRef extends ActorRefShared with java.lang.Comparable[ActorRef] { scal protected[akka] def checkReceiveTimeout = { cancelReceiveTimeout if (receiveTimeout.isDefined && dispatcher.mailboxSize(this) <= 0) { //Only reschedule if desired and there are currently no more messages to be processed - log.slf4j.debug("Scheduling timeout for %s", this) + log.slf4j.debug("Scheduling timeout for {}", this) _futureTimeout = Some(Scheduler.scheduleOnce(this, ReceiveTimeout, receiveTimeout.get, TimeUnit.MILLISECONDS)) } } @@ -587,7 +587,7 @@ trait ActorRef extends ActorRefShared with java.lang.Comparable[ActorRef] { scal if (_futureTimeout.isDefined) { _futureTimeout.get.cancel(true) _futureTimeout = None - log.slf4j.debug("Timeout canceled for %s", this) + log.slf4j.debug("Timeout canceled for {}", this) } } } @@ -764,7 +764,7 @@ class LocalActorRef private[akka] ( "Actor can only have one supervisor [" + actorRef + "], e.g. link(actor) fails") linkedActors.put(actorRef.uuid, actorRef) actorRef.supervisor = Some(this) - Actor.log.slf4j.debug("Linking actor [%s] to actor [%s]", actorRef, this) + Actor.log.slf4j.debug("Linking actor [{}] to actor [{}]", actorRef, this) } /** @@ -777,7 +777,7 @@ class LocalActorRef private[akka] ( "Actor [" + actorRef + "] is not a linked actor, can't unlink") linkedActors.remove(actorRef.uuid) actorRef.supervisor = None - Actor.log.slf4j.debug("Unlinking actor [%s] from actor [%s]", actorRef, this) + Actor.log.slf4j.debug("Unlinking actor [{}] from actor [{}]", actorRef, this) } /** @@ -911,14 +911,14 @@ class LocalActorRef private[akka] ( * Callback for the dispatcher. This is the single entry point to the user Actor implementation. */ protected[akka] def invoke(messageHandle: MessageInvocation): Unit = guard.withGuard { - if (isShutdown) Actor.log.slf4j.warn("Actor [%s] is shut down,\n\tignoring message [%s]", toString, messageHandle) + if (isShutdown) Actor.log.slf4j.warn("Actor [{}] is shut down,\n\tignoring message [{}]", toString, messageHandle) else { currentMessage = messageHandle try { dispatch(messageHandle) } catch { case e => - Actor.log.slf4j.error("Could not invoke actor [%s]", this) + Actor.log.slf4j.error("Could not invoke actor [{}]", this) Actor.log.slf4j.error("Problem", e) throw e } finally { @@ -973,9 +973,9 @@ class LocalActorRef private[akka] ( protected[akka] def restart(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]) { def performRestart { - Actor.log.slf4j.info("Restarting actor [%s] configured as PERMANENT.", id) + Actor.log.slf4j.info("Restarting actor [{}] configured as PERMANENT.", id) val failedActor = actorInstance.get - Actor.log.slf4j.debug("Invoking 'preRestart' for failed actor instance [%s].", id) + Actor.log.slf4j.debug("Invoking 'preRestart' for failed actor instance [{}].", id) failedActor.preRestart(reason) val freshActor = newActor setActorSelfFields(failedActor,null) //Only null out the references if we could instantiate the new actor @@ -985,16 +985,16 @@ class LocalActorRef private[akka] ( case p: Proxyable => p.swapProxiedActor(freshActor) case _ => } - Actor.log.slf4j.debug("Invoking 'postRestart' for new actor instance [%s].", id) + Actor.log.slf4j.debug("Invoking 'postRestart' for new actor instance [{}].", id) freshActor.postRestart(reason) } def tooManyRestarts { Actor.log.slf4j.warn( - "Maximum number of restarts [%s] within time range [%s] reached." + - "\n\tWill *not* restart actor [%s] anymore." + + "Maximum number of restarts [{}] within time range [{}] reached." + + "\n\tWill *not* restart actor [{}] anymore." + "\n\tLast exception causing restart was" + - "\n\t[%s].", + "\n\t[{}].", Array(maxNrOfRetries, withinTimeRange, this, reason)) _supervisor.foreach { sup => // can supervisor handle the notification? @@ -1002,7 +1002,7 @@ class LocalActorRef private[akka] ( if (sup.isDefinedAt(notification)) notifySupervisorWithMessage(notification) else Actor.log.slf4j.warn( "No message handler defined for system message [MaximumNumberOfRestartsWithinTimeRangeReached]" + - "\n\tCan't send the message to the supervisor [%s].", sup) + "\n\tCan't send the message to the supervisor [{}].", sup) } stop @@ -1025,7 +1025,7 @@ class LocalActorRef private[akka] ( case e => false //An error or exception here should trigger a retry } - Actor.log.slf4j.debug("Restart: %s for [%s].", success, id) + Actor.log.slf4j.debug("Restart: {} for [{}].", success, id) if (success) { _status = ActorRefInternals.RUNNING @@ -1080,7 +1080,7 @@ class LocalActorRef private[akka] ( } private def dispatch[T](messageHandle: MessageInvocation) = { - Actor.log.slf4j.trace("Invoking actor with message: %s\n", messageHandle) + Actor.log.slf4j.trace("Invoking actor with message: {}\n", messageHandle) val message = messageHandle.message //serializeMessage(messageHandle.message) try { @@ -1096,14 +1096,14 @@ class LocalActorRef private[akka] ( } private def shutDownTemporaryActor(temporaryActor: ActorRef) { - Actor.log.slf4j.info("Actor [%s] configured as TEMPORARY and will not be restarted.", temporaryActor.id) + Actor.log.slf4j.info("Actor [{}] configured as TEMPORARY and will not be restarted.", temporaryActor.id) temporaryActor.stop linkedActors.remove(temporaryActor.uuid) // remove the temporary actor // if last temporary actor is gone, then unlink me from supervisor if (linkedActors.isEmpty) { Actor.log.slf4j.info( "All linked actors have died permanently (they were all configured as TEMPORARY)" + - "\n\tshutting down and unlinking supervisor actor as well [%s].", + "\n\tshutting down and unlinking supervisor actor as well [{}].", temporaryActor.id) notifySupervisorWithMessage(UnlinkAndStop(this)) } @@ -1112,7 +1112,7 @@ class LocalActorRef private[akka] ( } private def handleExceptionInDispatch(reason: Throwable, message: Any) = { - Actor.log.slf4j.error("Exception when invoking \n\tactor [%s] \n\twith message [%s]", this, message) + Actor.log.slf4j.error("Exception when invoking \n\tactor [{}] \n\twith message [{}]", this, message) Actor.log.slf4j.error("Problem", reason) //Prevent any further messages to be processed until the actor has been restarted @@ -1170,7 +1170,7 @@ class LocalActorRef private[akka] ( private def initializeActorInstance = { actor.preStart // run actor preStart - Actor.log.slf4j.trace("[%s] has started", toString) + Actor.log.slf4j.trace("[{}] has started", toString) ActorRegistry.register(this) } diff --git a/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala b/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala index 8456cb4330..3d3f06a2c5 100644 --- a/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala +++ b/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala @@ -26,7 +26,7 @@ trait BootableActorLoaderService extends Bootable with Logging { val DEPLOY = HOME.getOrElse(throwNoAkkaHomeException) + "/deploy" val DEPLOY_DIR = new File(DEPLOY) if (!DEPLOY_DIR.exists) { - log.slf4j.error("Could not find a deploy directory at [%s]", DEPLOY) + log.slf4j.error("Could not find a deploy directory at [{}]", DEPLOY) System.exit(-1) } val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList @@ -42,8 +42,8 @@ trait BootableActorLoaderService extends Bootable with Logging { } } val toDeploy = filesToDeploy.map(_.toURI.toURL) - log.slf4j.info("Deploying applications from [%s]: [%s]", DEPLOY, toDeploy) - log.slf4j.debug("Loading dependencies [%s]", dependencyJars) + log.slf4j.info("Deploying applications from [{}]: [{}]", DEPLOY, toDeploy) + log.slf4j.debug("Loading dependencies [{}]", dependencyJars) val allJars = toDeploy ::: dependencyJars new URLClassLoader(allJars.toArray,Thread.currentThread.getContextClassLoader) @@ -56,7 +56,7 @@ trait BootableActorLoaderService extends Bootable with Logging { super.onLoad for (loader <- applicationLoader; clazz <- BOOT_CLASSES) { - log.slf4j.info("Loading boot class [%s]", clazz) + log.slf4j.info("Loading boot class [{}]", clazz) loader.loadClass(clazz).newInstance } } diff --git a/akka-actor/src/main/scala/akka/actor/FSM.scala b/akka-actor/src/main/scala/akka/actor/FSM.scala index 19514ac6ac..b569e89e29 100644 --- a/akka-actor/src/main/scala/akka/actor/FSM.scala +++ b/akka-actor/src/main/scala/akka/actor/FSM.scala @@ -69,17 +69,17 @@ trait FSM[S, D] { private var handleEvent: StateFunction = { case Event(value, stateData) => - log.slf4j.warn("Event %s not handled in state %s, staying at current state", value, currentState.stateName) + log.slf4j.warn("Event {} not handled in state {}, staying at current state", value, currentState.stateName) stay } private var terminateEvent: PartialFunction[Reason, Unit] = { - case failure@Failure(_) => log.slf4j.error("Stopping because of a %s", failure) - case reason => log.slf4j.info("Stopping because of reason: %s", reason) + case failure@Failure(_) => log.slf4j.error("Stopping because of a {}", failure) + case reason => log.slf4j.info("Stopping because of reason: {}", reason) } private var transitionEvent: PartialFunction[Transition, Unit] = { - case Transition(from, to) => log.slf4j.debug("Transitioning from state %s to %s", from, to) + case Transition(from, to) => log.slf4j.debug("Transitioning from state {} to {}", from, to) } override final protected def receive: Receive = { @@ -123,7 +123,7 @@ trait FSM[S, D] { def replying(replyValue:Any): State = { self.sender match { case Some(sender) => sender ! replyValue - case None => log.slf4j.error("Unable to send reply value %s, no sender reference to reply to", replyValue) + case None => log.slf4j.error("Unable to send reply value {}, no sender reference to reply to", replyValue) } this } diff --git a/akka-actor/src/main/scala/akka/actor/Scheduler.scala b/akka-actor/src/main/scala/akka/actor/Scheduler.scala index a0d9a9ee8f..2096710088 100644 --- a/akka-actor/src/main/scala/akka/actor/Scheduler.scala +++ b/akka-actor/src/main/scala/akka/actor/Scheduler.scala @@ -36,7 +36,7 @@ object Scheduler extends Logging { */ def schedule(receiver: ActorRef, message: AnyRef, initialDelay: Long, delay: Long, timeUnit: TimeUnit): ScheduledFuture[AnyRef] = { log.slf4j.trace( - "Schedule scheduled event\n\tevent = [%s]\n\treceiver = [%s]\n\tinitialDelay = [%s]\n\tdelay = [%s]\n\ttimeUnit = [%s]", + "Schedule scheduled event\n\tevent = [{}]\n\treceiver = [{}]\n\tinitialDelay = [{}]\n\tdelay = [{}]\n\ttimeUnit = [{}]", Array(message, receiver, initialDelay, delay, timeUnit)) try { service.scheduleAtFixedRate( @@ -60,7 +60,7 @@ object Scheduler extends Logging { */ def schedule(runnable: Runnable, initialDelay: Long, delay: Long, timeUnit: TimeUnit): ScheduledFuture[AnyRef] = { log.slf4j.trace( - "Schedule scheduled event\n\trunnable = [%s]\n\tinitialDelay = [%s]\n\tdelay = [%s]\n\ttimeUnit = [%s]", + "Schedule scheduled event\n\trunnable = [{}]\n\tinitialDelay = [{}]\n\tdelay = [{}]\n\ttimeUnit = [{}]", Array(runnable, initialDelay, delay, timeUnit)) try { @@ -75,7 +75,7 @@ object Scheduler extends Logging { */ def scheduleOnce(receiver: ActorRef, message: AnyRef, delay: Long, timeUnit: TimeUnit): ScheduledFuture[AnyRef] = { log.slf4j.trace( - "Schedule one-time event\n\tevent = [%s]\n\treceiver = [%s]\n\tdelay = [%s]\n\ttimeUnit = [%s]", + "Schedule one-time event\n\tevent = [{}]\n\treceiver = [{}]\n\tdelay = [{}]\n\ttimeUnit = [{}]", Array(message, receiver, delay, timeUnit)) try { service.schedule( @@ -99,7 +99,7 @@ object Scheduler extends Logging { */ def scheduleOnce(runnable: Runnable, delay: Long, timeUnit: TimeUnit): ScheduledFuture[AnyRef] = { log.slf4j.trace( - "Schedule one-time event\n\trunnable = [%s]\n\tdelay = [%s]\n\ttimeUnit = [%s]", + "Schedule one-time event\n\trunnable = [{}]\n\tdelay = [{}]\n\ttimeUnit = [{}]", Array(runnable, delay, timeUnit)) try { service.schedule(runnable,delay, timeUnit).asInstanceOf[ScheduledFuture[AnyRef]] diff --git a/akka-actor/src/main/scala/akka/config/Config.scala b/akka-actor/src/main/scala/akka/config/Config.scala index 4d5c336a88..419d268012 100644 --- a/akka-actor/src/main/scala/akka/config/Config.scala +++ b/akka-actor/src/main/scala/akka/config/Config.scala @@ -57,7 +57,7 @@ object Config extends Logging { val configFile = System.getProperty("akka.config", "") try { Configgy.configure(configFile) - log.slf4j.info("Config loaded from -Dakka.config=%s", configFile) + log.slf4j.info("Config loaded from -Dakka.config={}", configFile) } catch { case e: ParseException => throw new ConfigurationException( "Config could not be loaded from -Dakka.config=" + configFile + @@ -69,7 +69,7 @@ object Config extends Logging { val configFile = HOME.getOrElse(throwNoAkkaHomeException) + "/config/" + confName Configgy.configure(configFile) log.slf4j.info( - "AKKA_HOME is defined as [%s], config loaded from [%s].", + "AKKA_HOME is defined as [{}], config loaded from [{}].", HOME.getOrElse(throwNoAkkaHomeException), configFile) } catch { @@ -82,7 +82,7 @@ object Config extends Logging { } else if (getClass.getClassLoader.getResource(confName) ne null) { try { Configgy.configureFromResource(confName, getClass.getClassLoader) - log.slf4j.info("Config [%s] loaded from the application classpath.",confName) + log.slf4j.info("Config [{}] loaded from the application classpath.",confName) } catch { case e: ParseException => throw new ConfigurationException( "Can't load '" + confName + "' config file from application classpath," + diff --git a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala index 57796ee619..d83ef4ee37 100644 --- a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala +++ b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala @@ -123,12 +123,12 @@ class ExecutorBasedEventDrivenDispatcher( private[akka] def createDurableMailbox(actorRef: ActorRef, mailboxType: DurableMailboxType): AnyRef = createMailbox(mailboxType.mailboxImplClassname, actorRef) - private[akka] def start = log.slf4j.debug("Starting up %s\n\twith throughput [%d]", toString, throughput) + private[akka] def start = log.slf4j.debug("Starting up {}\n\twith throughput [%d]", toString, throughput) private[akka] def shutdown { val old = executorService.getAndSet(config.createLazyExecutorService(threadFactory)) if (old ne null) { - log.slf4j.debug("Shutting down %s", toString) + log.slf4j.debug("Shutting down {}", toString) old.shutdownNow() } } @@ -144,17 +144,17 @@ class ExecutorBasedEventDrivenDispatcher( throw e } } - } else log.slf4j.warn("%s is shut down,\n\tignoring the rest of the messages in the mailbox of\n\t%s", this, mbox) + } else log.slf4j.warn("{} is shut down,\n\tignoring the rest of the messages in the mailbox of\n\t{}", this, mbox) override val toString = getClass.getSimpleName + "[" + name + "]" def suspend(actorRef: ActorRef) { - log.slf4j.debug("Suspending %s",actorRef.uuid) + log.slf4j.debug("Suspending {}",actorRef.uuid) getMailbox(actorRef).suspended.switchOn } def resume(actorRef: ActorRef) { - log.slf4j.debug("Resuming %s",actorRef.uuid) + log.slf4j.debug("Resuming {}",actorRef.uuid) val mbox = getMailbox(actorRef) mbox.suspended.switchOff registerForExecution(mbox) diff --git a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala index 74ec3c8760..7ced9f8f0e 100644 --- a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala +++ b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala @@ -171,12 +171,12 @@ class ExecutorBasedEventDrivenWorkStealingDispatcher( } else false } - private[akka] def start = log.slf4j.debug("Starting up %s",toString) + private[akka] def start = log.slf4j.debug("Starting up {}",toString) private[akka] def shutdown { val old = executorService.getAndSet(config.createLazyExecutorService(threadFactory)) if (old ne null) { - log.slf4j.debug("Shutting down %s", toString) + log.slf4j.debug("Shutting down {}", toString) old.shutdownNow() } } @@ -244,7 +244,7 @@ class ExecutorBasedEventDrivenWorkStealingDispatcher( case Some(aType) => if (aType != actorOfId.actor.getClass) throw new IllegalActorStateException(String.format( - "Can't register actor %s in a work stealing dispatcher which already knows actors of type %s", + "Can't register actor {} in a work stealing dispatcher which already knows actors of type {}", actorOfId.actor, aType)) } } diff --git a/akka-actor/src/main/scala/akka/dispatch/ThreadPoolBuilder.scala b/akka-actor/src/main/scala/akka/dispatch/ThreadPoolBuilder.scala index 5280da7bd6..fa7f4acf19 100644 --- a/akka-actor/src/main/scala/akka/dispatch/ThreadPoolBuilder.scala +++ b/akka-actor/src/main/scala/akka/dispatch/ThreadPoolBuilder.scala @@ -179,13 +179,13 @@ class MonitorableThread(runnable: Runnable, name: String) override def run = { val debug = MonitorableThread.debugLifecycle - log.slf4j.debug("Created thread %s", getName) + log.slf4j.debug("Created thread {}", getName) try { MonitorableThread.alive.incrementAndGet super.run } finally { MonitorableThread.alive.decrementAndGet - log.slf4j.debug("Exiting thread %s", getName) + log.slf4j.debug("Exiting thread {}", getName) } } } diff --git a/akka-actor/src/main/scala/akka/util/Helpers.scala b/akka-actor/src/main/scala/akka/util/Helpers.scala index 166ad95944..09f6865984 100644 --- a/akka-actor/src/main/scala/akka/util/Helpers.scala +++ b/akka-actor/src/main/scala/akka/util/Helpers.scala @@ -42,7 +42,7 @@ object Helpers extends Logging { narrow(o) } catch { case e: ClassCastException => - log.slf4j.warn("Cannot narrow %s to expected type %s!", o, implicitly[Manifest[T]].erasure.getName) + log.slf4j.warn("Cannot narrow {} to expected type {}!", o, implicitly[Manifest[T]].erasure.getName) log.slf4j.trace("narrowSilently", e) None } diff --git a/akka-actor/src/main/scala/akka/util/ListenerManagement.scala b/akka-actor/src/main/scala/akka/util/ListenerManagement.scala index 2387bccd89..f372fac18c 100644 --- a/akka-actor/src/main/scala/akka/util/ListenerManagement.scala +++ b/akka-actor/src/main/scala/akka/util/ListenerManagement.scala @@ -57,7 +57,7 @@ trait ListenerManagement extends Logging { while (iterator.hasNext) { val listener = iterator.next if (listener.isRunning) listener ! msg - else log.slf4j.warn("Can't notify [%s] since it is not running.", listener) + else log.slf4j.warn("Can't notify [{}] since it is not running.", listener) } } } @@ -70,7 +70,7 @@ trait ListenerManagement extends Logging { while (iterator.hasNext) { val listener = iterator.next if (listener.isRunning) f(listener) - else log.slf4j.warn("Can't notify [%s] since it is not running.", listener) + else log.slf4j.warn("Can't notify [{}] since it is not running.", listener) } } } diff --git a/akka-actor/src/main/scala/akka/util/Logging.scala b/akka-actor/src/main/scala/akka/util/Logging.scala index d640824acb..0210d015c0 100644 --- a/akka-actor/src/main/scala/akka/util/Logging.scala +++ b/akka-actor/src/main/scala/akka/util/Logging.scala @@ -26,13 +26,17 @@ trait Logging { * Example: *
  * class Foo extends Logging {
- *   log.slf4j.info("My foo is %s","alive")
- *   log.slf4j.error(new Exception(),"My foo is %s","broken")
+ *   log.info("My foo is %s","alive")
+ *   log.error(new Exception(),"My foo is %s","broken")
  * }
  * 
* * The logger uses String.format: * http://download-llnw.oracle.com/javase/6/docs/api/java/lang/String.html#format(java.lang.String,%20java.lang.Object...) + * + * If you want to use underlying slf4j Logger, do: + * log.slf4j.info("My foo is {}","alive") + * log.slf4j.error("My foo is broken",new Exception()) */ class Logger(val slf4j: SLFLogger) { final def name = logger.getName diff --git a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala index cdf35dbaa9..45e1609b79 100644 --- a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala +++ b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala @@ -185,7 +185,7 @@ object ReflectiveAccess extends Logging { Some(ctor.newInstance(args: _*).asInstanceOf[T]) } catch { case e => - log.slf4j.warn("Could not instantiate class [%s] due to [%s]", clazz.getName, e.getCause) + log.slf4j.warn("Could not instantiate class [{}] due to [{}]", clazz.getName, e.getCause) None } @@ -202,7 +202,7 @@ object ReflectiveAccess extends Logging { Some(ctor.newInstance(args: _*).asInstanceOf[T]) } catch { case e => - log.slf4j.warn("Could not instantiate class [%s] due to [%s]", fqn, e.getCause) + log.slf4j.warn("Could not instantiate class [{}] due to [{}]", fqn, e.getCause) None } @@ -214,7 +214,7 @@ object ReflectiveAccess extends Logging { Option(instance.get(null).asInstanceOf[T]) } catch { case e: ClassNotFoundException => - log.slf4j.debug("Could not get object [%s] due to [%s]", fqn, e) + log.slf4j.debug("Could not get object [{}] due to [{}]", fqn, e) None } diff --git a/akka-actor/src/test/scala/akka/actor/actor/FSMActorSpec.scala b/akka-actor/src/test/scala/akka/actor/actor/FSMActorSpec.scala index bdd9cbe9f4..d6a80565da 100644 --- a/akka-actor/src/test/scala/akka/actor/actor/FSMActorSpec.scala +++ b/akka-actor/src/test/scala/akka/actor/actor/FSMActorSpec.scala @@ -40,7 +40,7 @@ object FSMActorSpec { goto(Open) using CodeState("", code) until timeout } case wrong => { - log.slf4j.error("Wrong code %s", wrong) + log.slf4j.error("Wrong code {}", wrong) stay using CodeState("", code) } } diff --git a/akka-http/src/main/scala/AkkaLoader.scala b/akka-http/src/main/scala/AkkaLoader.scala index 720f988434..ec526a7639 100644 --- a/akka-http/src/main/scala/AkkaLoader.scala +++ b/akka-http/src/main/scala/AkkaLoader.scala @@ -71,7 +71,7 @@ class AkkaLoader extends Logging { log.slf4j.info(" ttt tt ttt ttt ttt ttt ttt ttt") log.slf4j.info(" tttttttt ttt ttt ttt ttt tttttttt") log.slf4j.info("==================================================") - log.slf4j.info(" Running version %s", Config.VERSION) + log.slf4j.info(" Running version {}", Config.VERSION) log.slf4j.info("==================================================") } } diff --git a/akka-http/src/main/scala/Security.scala b/akka-http/src/main/scala/Security.scala index dfd641bc04..bd50b0a1c7 100644 --- a/akka-http/src/main/scala/Security.scala +++ b/akka-http/src/main/scala/Security.scala @@ -91,7 +91,7 @@ class AkkaSecurityFilterFactory extends ResourceFilterFactory with Logging { throw new WebApplicationException(r.asInstanceOf[Response]) case None => throw new WebApplicationException(408) case unknown => { - log.slf4j.warn("Authenticator replied with unexpected result [%s]", unknown); + log.slf4j.warn("Authenticator replied with unexpected result [{}]", unknown) throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR) } } diff --git a/akka-remote/src/main/scala/akka/remote/RemoteClient.scala b/akka-remote/src/main/scala/akka/remote/RemoteClient.scala index cfe540ad72..d19d4eeeb4 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteClient.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteClient.scala @@ -238,7 +238,7 @@ class RemoteClient private[akka] ( bootstrap.setOption("tcpNoDelay", true) bootstrap.setOption("keepAlive", true) - log.slf4j.info("Starting remote client connection to [%s:%s]", hostname, port) + log.slf4j.info("Starting remote client connection to [{}:{}]", hostname, port) // Wait until the connection attempt succeeds or fails. connection = bootstrap.connect(remoteAddress) @@ -247,14 +247,14 @@ class RemoteClient private[akka] ( if (!connection.isSuccess) { notifyListeners(RemoteClientError(connection.getCause, this)) - log.slf4j.error("Remote client connection to [%s:%s] has failed", hostname, port) + log.slf4j.error("Remote client connection to [{}:{}] has failed", hostname, port) log.slf4j.debug("Remote client connection failed", connection.getCause) } notifyListeners(RemoteClientStarted(this)) } def shutdown = runSwitch switchOff { - log.slf4j.info("Shutting down %s", name) + log.slf4j.info("Shutting down {}", name) notifyListeners(RemoteClientShutdown(this)) timer.stop timer = null @@ -263,7 +263,7 @@ class RemoteClient private[akka] ( bootstrap.releaseExternalResources bootstrap = null connection = null - log.slf4j.info("%s has been shut down", name) + log.slf4j.info("{} has been shut down", name) } @deprecated("Use addListener instead") @@ -342,7 +342,7 @@ class RemoteClient private[akka] ( } else { val timeLeft = reconnectionTimeWindow - (System.currentTimeMillis - reconnectionTimeWindowStart) if (timeLeft > 0) { - log.slf4j.info("Will try to reconnect to remote server for another [%s] milliseconds", timeLeft) + log.slf4j.info("Will try to reconnect to remote server for another [{}] milliseconds", timeLeft) true } else false } @@ -418,7 +418,7 @@ class RemoteClientHandler( if (result.isInstanceOf[RemoteMessageProtocol]) { val reply = result.asInstanceOf[RemoteMessageProtocol] val replyUuid = uuidFrom(reply.getUuid.getHigh, reply.getUuid.getLow) - log.slf4j.debug("Remote client received RemoteMessageProtocol[\n%s]".format(reply.toString)) + log.debug("Remote client received RemoteMessageProtocol[\n{}]",reply) val future = futures.get(replyUuid).asInstanceOf[CompletableFuture[Any]] if (reply.hasMessage) { if (future eq null) throw new IllegalActorStateException("Future mapped to UUID " + replyUuid + " does not exist") @@ -446,7 +446,7 @@ class RemoteClientHandler( } catch { case e: Exception => client.notifyListeners(RemoteClientError(e, client)) - log.slf4j.error("Unexpected exception in remote client handler: %s", e) + log.slf4j.error("Unexpected exception in remote client handler: {}", e) throw e } } @@ -457,12 +457,12 @@ class RemoteClientHandler( def run(timeout: Timeout) = { client.openChannels.remove(event.getChannel) client.isAuthenticated.set(false) - log.slf4j.debug("Remote client reconnecting to [%s]", remoteAddress) + log.slf4j.debug("Remote client reconnecting to [{}]", remoteAddress) client.connection = bootstrap.connect(remoteAddress) client.connection.awaitUninterruptibly // Wait until the connection attempt succeeds or fails. if (!client.connection.isSuccess) { client.notifyListeners(RemoteClientError(client.connection.getCause, client)) - log.slf4j.error("Reconnection to [%s] has failed", remoteAddress) + log.slf4j.error("Reconnection to [{}] has failed", remoteAddress) log.slf4j.debug("Reconnection failed", client.connection.getCause) } } @@ -473,7 +473,7 @@ class RemoteClientHandler( override def channelConnected(ctx: ChannelHandlerContext, event: ChannelStateEvent) = { def connect = { client.notifyListeners(RemoteClientConnected(client)) - log.slf4j.debug("Remote client connected to [%s]", ctx.getChannel.getRemoteAddress) + log.slf4j.debug("Remote client connected to [{}]", ctx.getChannel.getRemoteAddress) client.resetReconnectionTimeWindow } @@ -490,7 +490,7 @@ class RemoteClientHandler( override def channelDisconnected(ctx: ChannelHandlerContext, event: ChannelStateEvent) = { client.notifyListeners(RemoteClientDisconnected(client)) - log.slf4j.debug("Remote client disconnected from [%s]", ctx.getChannel.getRemoteAddress) + log.slf4j.debug("Remote client disconnected from [{}]", ctx.getChannel.getRemoteAddress) } override def exceptionCaught(ctx: ChannelHandlerContext, event: ExceptionEvent) = { diff --git a/akka-remote/src/main/scala/akka/remote/RemoteServer.scala b/akka-remote/src/main/scala/akka/remote/RemoteServer.scala index f4f8185943..d4e129d496 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteServer.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteServer.scala @@ -233,7 +233,7 @@ class RemoteServer extends Logging with ListenerManagement { try { if (!_isRunning) { address = Address(_hostname,_port) - log.slf4j.info("Starting remote server at [%s:%s]", hostname, port) + log.slf4j.info("Starting remote server at [{}:{}]", hostname, port) RemoteServer.register(hostname, port, this) val pipelineFactory = new RemoteServerPipelineFactory(name, openChannels, loader, this) @@ -281,7 +281,7 @@ class RemoteServer extends Logging with ListenerManagement { * @param typedActor typed actor to register */ def registerTypedActor(id: String, typedActor: AnyRef): Unit = synchronized { - log.slf4j.debug("Registering server side remote typed actor [%s] with id [%s]", typedActor.getClass.getName, id) + log.slf4j.debug("Registering server side remote typed actor [{}] with id [{}]", typedActor.getClass.getName, id) if (id.startsWith(UUID_PREFIX)) registerTypedActor(id.substring(UUID_PREFIX.length), typedActor, typedActorsByUuid) else registerTypedActor(id, typedActor, typedActors) } @@ -297,7 +297,7 @@ class RemoteServer extends Logging with ListenerManagement { * @param typedActor typed actor to register */ def registerTypedPerSessionActor(id: String, factory: => AnyRef): Unit = synchronized { - log.slf4j.debug("Registering server side typed remote session actor with id [%s]", id) + log.slf4j.debug("Registering server side typed remote session actor with id [{}]", id) registerTypedPerSessionActor(id, () => factory, typedActorsFactories) } @@ -312,7 +312,7 @@ class RemoteServer extends Logging with ListenerManagement { * NOTE: If you use this method to register your remote actor then you must unregister the actor by this ID yourself. */ def register(id: String, actorRef: ActorRef): Unit = synchronized { - log.slf4j.debug("Registering server side remote actor [%s] with id [%s]", actorRef.actorClass.getName, id) + log.slf4j.debug("Registering server side remote actor [{}] with id [{}]", actorRef.actorClass.getName, id) if (id.startsWith(UUID_PREFIX)) register(id.substring(UUID_PREFIX.length), actorRef, actorsByUuid) else register(id, actorRef, actors) } @@ -323,7 +323,7 @@ class RemoteServer extends Logging with ListenerManagement { * NOTE: If you use this method to register your remote actor then you must unregister the actor by this ID yourself. */ def registerPerSession(id: String, factory: => ActorRef): Unit = synchronized { - log.slf4j.debug("Registering server side remote session actor with id [%s]", id) + log.slf4j.debug("Registering server side remote session actor with id [{}]", id) registerPerSession(id, () => factory, actorsFactories) } @@ -354,7 +354,7 @@ class RemoteServer extends Logging with ListenerManagement { */ def unregister(actorRef: ActorRef):Unit = synchronized { if (_isRunning) { - log.slf4j.debug("Unregistering server side remote actor [%s] with id [%s:%s]", Array(actorRef.actorClass.getName, actorRef.id, actorRef.uuid)) + log.slf4j.debug("Unregistering server side remote actor [{}] with id [{}:{}]", Array(actorRef.actorClass.getName, actorRef.id, actorRef.uuid)) actors.remove(actorRef.id, actorRef) actorsByUuid.remove(actorRef.uuid, actorRef) } @@ -367,7 +367,7 @@ class RemoteServer extends Logging with ListenerManagement { */ def unregister(id: String):Unit = synchronized { if (_isRunning) { - log.slf4j.info("Unregistering server side remote actor with id [%s]", id) + log.slf4j.info("Unregistering server side remote actor with id [{}]", id) if (id.startsWith(UUID_PREFIX)) actorsByUuid.remove(id.substring(UUID_PREFIX.length)) else { val actorRef = actors get id @@ -384,7 +384,7 @@ class RemoteServer extends Logging with ListenerManagement { */ def unregisterPerSession(id: String):Unit = { if (_isRunning) { - log.slf4j.info("Unregistering server side remote session actor with id [%s]", id) + log.slf4j.info("Unregistering server side remote session actor with id [{}]", id) actorsFactories.remove(id) } } @@ -396,7 +396,7 @@ class RemoteServer extends Logging with ListenerManagement { */ def unregisterTypedActor(id: String):Unit = synchronized { if (_isRunning) { - log.slf4j.info("Unregistering server side remote typed actor with id [%s]", id) + log.slf4j.info("Unregistering server side remote typed actor with id [{}]", id) if (id.startsWith(UUID_PREFIX)) typedActorsByUuid.remove(id.substring(UUID_PREFIX.length)) else typedActors.remove(id) } @@ -506,7 +506,7 @@ class RemoteServerHandler( val clientAddress = getClientAddress(ctx) sessionActors.set(event.getChannel(), new ConcurrentHashMap[String, ActorRef]()) typedSessionActors.set(event.getChannel(), new ConcurrentHashMap[String, AnyRef]()) - log.slf4j.debug("Remote client [%s] connected to [%s]", clientAddress, server.name) + log.slf4j.debug("Remote client [{}] connected to [{}]", clientAddress, server.name) if (RemoteServer.SECURE) { val sslHandler: SslHandler = ctx.getPipeline.get(classOf[SslHandler]) // Begin handshake. @@ -524,7 +524,7 @@ class RemoteServerHandler( override def channelDisconnected(ctx: ChannelHandlerContext, event: ChannelStateEvent) = { val clientAddress = getClientAddress(ctx) - log.slf4j.debug("Remote client [%s] disconnected from [%s]", clientAddress, server.name) + log.slf4j.debug("Remote client [{}] disconnected from [{}]", clientAddress, server.name) // stop all session actors val channelActors = sessionActors.remove(event.getChannel) if (channelActors ne null) { @@ -546,7 +546,7 @@ class RemoteServerHandler( override def channelClosed(ctx: ChannelHandlerContext, event: ChannelStateEvent) = { val clientAddress = getClientAddress(ctx) - log.slf4j.debug("Remote client [%s] channel closed from [%s]", clientAddress, server.name) + log.slf4j.debug("Remote client [{}] channel closed from [{}]", clientAddress, server.name) server.notifyListeners(RemoteServerClientClosed(server, clientAddress)) } @@ -580,7 +580,7 @@ class RemoteServerHandler( } private def handleRemoteMessageProtocol(request: RemoteMessageProtocol, channel: Channel) = { - log.slf4j.debug("Received RemoteMessageProtocol[\n%s]".format(request.toString)) + log.slf4j.debug("Received RemoteMessageProtocol[\n{}]",request) request.getActorInfo.getActorType match { case SCALA_ACTOR => dispatchToActor(request, channel) case TYPED_ACTOR => dispatchToTypedActor(request, channel) @@ -591,7 +591,7 @@ class RemoteServerHandler( private def dispatchToActor(request: RemoteMessageProtocol, channel: Channel) { val actorInfo = request.getActorInfo - log.slf4j.debug("Dispatching to remote actor [%s:%s]", actorInfo.getTarget, actorInfo.getUuid) + log.slf4j.debug("Dispatching to remote actor [{}:{}]", actorInfo.getTarget, actorInfo.getUuid) val actorRef = try { @@ -627,7 +627,7 @@ class RemoteServerHandler( val exception = f.exception if (exception.isDefined) { - log.slf4j.debug("Returning exception from actor invocation [%s]",exception.get) + log.slf4j.debug("Returning exception from actor invocation [{}]",exception.get) try { channel.write(createErrorReplyMessage(exception.get, request, AkkaActorType.ScalaActor)) } catch { @@ -635,7 +635,7 @@ class RemoteServerHandler( } } else if (result.isDefined) { - log.slf4j.debug("Returning result from actor invocation [%s]".format(result.get)) + log.slf4j.debug("Returning result from actor invocation [{}]",result.get) val messageBuilder = RemoteActorSerialization.createRemoteMessageProtocolBuilder( Some(actorRef), Right(request.getUuid), @@ -667,7 +667,7 @@ class RemoteServerHandler( private def dispatchToTypedActor(request: RemoteMessageProtocol, channel: Channel) = { val actorInfo = request.getActorInfo val typedActorInfo = actorInfo.getTypedActorInfo - log.slf4j.debug("Dispatching to remote typed actor [%s :: %s]", typedActorInfo.getMethod, typedActorInfo.getInterface) + log.slf4j.debug("Dispatching to remote typed actor [{} :: {}]", typedActorInfo.getMethod, typedActorInfo.getInterface) val typedActor = createTypedActor(actorInfo, channel) val args = MessageSerializer.deserialize(request.getMessage).asInstanceOf[Array[AnyRef]].toList @@ -693,7 +693,7 @@ class RemoteServerHandler( None) if (request.hasSupervisorUuid) messageBuilder.setSupervisorUuid(request.getSupervisorUuid) channel.write(messageBuilder.build) - log.slf4j.debug("Returning result from remote typed actor invocation [%s]", result) + log.slf4j.debug("Returning result from remote typed actor invocation [{}]", result) } catch { case e: Throwable => server.notifyListeners(RemoteServerError(e, server)) } @@ -798,7 +798,7 @@ class RemoteServerHandler( if (RemoteServer.UNTRUSTED_MODE) throw new SecurityException( "Remote server is operating is untrusted mode, can not create remote actors on behalf of the remote client") - log.slf4j.info("Creating a new remote actor [%s:%s]", name, uuid) + log.slf4j.info("Creating a new remote actor [{}:{}]", name, uuid) val clazz = if (applicationLoader.isDefined) applicationLoader.get.loadClass(name) else Class.forName(name) val actorRef = Actor.actorOf(clazz.asInstanceOf[Class[_ <: Actor]]) @@ -874,7 +874,7 @@ class RemoteServerHandler( if (RemoteServer.UNTRUSTED_MODE) throw new SecurityException( "Remote server is operating is untrusted mode, can not create remote actors on behalf of the remote client") - log.slf4j.info("Creating a new remote typed actor:\n\t[%s :: %s]", interfaceClassname, targetClassname) + log.slf4j.info("Creating a new remote typed actor:\n\t[{} :: {}]", interfaceClassname, targetClassname) val (interfaceClass, targetClass) = if (applicationLoader.isDefined) (applicationLoader.get.loadClass(interfaceClassname), @@ -913,7 +913,7 @@ class RemoteServerHandler( private def createErrorReplyMessage(exception: Throwable, request: RemoteMessageProtocol, actorType: AkkaActorType): RemoteMessageProtocol = { val actorInfo = request.getActorInfo - log.slf4j.error("Could not invoke remote actor [%s]", actorInfo.getTarget) + log.slf4j.error("Could not invoke remote actor [{}]", actorInfo.getTarget) log.slf4j.debug("Could not invoke remote actor", exception) val messageBuilder = RemoteActorSerialization.createRemoteMessageProtocolBuilder( None, @@ -942,7 +942,7 @@ class RemoteServerHandler( "The remote client [" + clientAddress + "] does not have a secure cookie.") if (!(request.getCookie == RemoteServer.SECURE_COOKIE.get)) throw new SecurityException( "The remote client [" + clientAddress + "] secure cookie is not the same as remote server secure cookie") - log.slf4j.info("Remote client [%s] successfully authenticated using secure cookie", clientAddress) + log.slf4j.info("Remote client [{}] successfully authenticated using secure cookie", clientAddress) } } } diff --git a/akka-remote/src/main/scala/akka/serialization/SerializationProtocol.scala b/akka-remote/src/main/scala/akka/serialization/SerializationProtocol.scala index 38061c8620..c0e49c80c5 100644 --- a/akka-remote/src/main/scala/akka/serialization/SerializationProtocol.scala +++ b/akka-remote/src/main/scala/akka/serialization/SerializationProtocol.scala @@ -226,7 +226,7 @@ object RemoteActorSerialization { * Deserializes a RemoteActorRefProtocol Protocol Buffers (protobuf) Message into an RemoteActorRef instance. */ private[akka] def fromProtobufToRemoteActorRef(protocol: RemoteActorRefProtocol, loader: Option[ClassLoader]): ActorRef = { - Actor.log.slf4j.debug("Deserializing RemoteActorRefProtocol to RemoteActorRef:\n %s", protocol) + Actor.log.slf4j.debug("Deserializing RemoteActorRefProtocol to RemoteActorRef:\n {}", protocol) RemoteActorRef( protocol.getClassOrServiceName, protocol.getActorClassname, @@ -244,7 +244,7 @@ object RemoteActorSerialization { val host = homeAddress.getHostName val port = homeAddress.getPort - Actor.log.slf4j.debug("Register serialized Actor [%s] as remote @ [%s:%s]", Array(actorClassName, host, port)) + Actor.log.slf4j.debug("Register serialized Actor [{}] as remote @ [{}:{}]", Array(actorClassName, host, port)) RemoteServer.getOrCreateServer(homeAddress) ActorRegistry.registerActorByUuid(homeAddress, uuid.toString, ar) diff --git a/akka-remote/src/test/scala/remote/ServerInitiatedRemoteActorSample.scala b/akka-remote/src/test/scala/remote/ServerInitiatedRemoteActorSample.scala index 236a35a993..836230d839 100644 --- a/akka-remote/src/test/scala/remote/ServerInitiatedRemoteActorSample.scala +++ b/akka-remote/src/test/scala/remote/ServerInitiatedRemoteActorSample.scala @@ -29,7 +29,7 @@ object ServerInitiatedRemoteActorClient extends Logging { def run = { val actor = RemoteClient.actorFor("hello-service", "localhost", 2552) val result = actor !! "Hello" - log.slf4j.info("Result from Remote Actor: %s", result) + log.slf4j.info("Result from Remote Actor: {}", result) } def main(args: Array[String]) = run diff --git a/akka-remote/src/test/scala/ticket/Ticket506Spec.scala b/akka-remote/src/test/scala/ticket/Ticket506Spec.scala index 7a15c00a2e..e82d4c5efb 100644 --- a/akka-remote/src/test/scala/ticket/Ticket506Spec.scala +++ b/akka-remote/src/test/scala/ticket/Ticket506Spec.scala @@ -58,4 +58,4 @@ class Ticket506Spec extends Spec with ShouldMatchers { s2.shutdown } } -} \ No newline at end of file +} diff --git a/akka-samples/akka-sample-remote/src/main/scala/ClientManagedRemoteActorSample.scala b/akka-samples/akka-sample-remote/src/main/scala/ClientManagedRemoteActorSample.scala index f9cba90ed1..1f85c73100 100644 --- a/akka-samples/akka-sample-remote/src/main/scala/ClientManagedRemoteActorSample.scala +++ b/akka-samples/akka-sample-remote/src/main/scala/ClientManagedRemoteActorSample.scala @@ -33,7 +33,7 @@ object ClientManagedRemoteActorClient extends Logging { log.slf4j.info("Remote actor created, moved to the server") log.slf4j.info("Sending 'Hello' to remote actor") val result = actor !! "Hello" - log.slf4j.info("Result from Remote Actor: '%s'", result.get) + log.slf4j.info("Result from Remote Actor: '{}'", result.get) } def main(args: Array[String]) = run diff --git a/akka-samples/akka-sample-remote/src/main/scala/ServerManagedRemoteActorSample.scala b/akka-samples/akka-sample-remote/src/main/scala/ServerManagedRemoteActorSample.scala index f743a447eb..b81bc485da 100644 --- a/akka-samples/akka-sample-remote/src/main/scala/ServerManagedRemoteActorSample.scala +++ b/akka-samples/akka-sample-remote/src/main/scala/ServerManagedRemoteActorSample.scala @@ -36,7 +36,7 @@ object ServerManagedRemoteActorClient extends Logging { log.slf4j.info("Remote client created") log.slf4j.info("Sending 'Hello' to remote actor") val result = actor !! "Hello" - log.slf4j.info("Result from Remote Actor: '%s'", result.get) + log.slf4j.info("Result from Remote Actor: '{}'", result.get) } def main(args: Array[String]) = run diff --git a/akka-typed-actor/src/main/scala/akka/config/TypedActorGuiceConfigurator.scala b/akka-typed-actor/src/main/scala/akka/config/TypedActorGuiceConfigurator.scala index 2d9e51c143..fc2f83c5d9 100644 --- a/akka-typed-actor/src/main/scala/akka/config/TypedActorGuiceConfigurator.scala +++ b/akka-typed-actor/src/main/scala/akka/config/TypedActorGuiceConfigurator.scala @@ -43,7 +43,7 @@ private[akka] class TypedActorGuiceConfigurator extends TypedActorConfiguratorBa * @return the typed actors for the class */ def getInstance[T](clazz: Class[T]): List[T] = synchronized { - log.slf4j.debug("Retrieving typed actor [%s]", clazz.getName) + log.slf4j.debug("Retrieving typed actor [{}]", clazz.getName) if (injector eq null) throw new IllegalActorStateException( "inject() and/or supervise() must be called before invoking getInstance(clazz)") val (proxy, targetInstance, component) =