diff --git a/src/main/scala/mesosphere/marathon/event/http/HttpEventActor.scala b/src/main/scala/mesosphere/marathon/event/http/HttpEventActor.scala index ca0ed0c4e00..ad48c63bdb8 100644 --- a/src/main/scala/mesosphere/marathon/event/http/HttpEventActor.scala +++ b/src/main/scala/mesosphere/marathon/event/http/HttpEventActor.scala @@ -2,16 +2,15 @@ package mesosphere.marathon.event.http import akka.actor._ import akka.pattern.ask +import mesosphere.marathon.api.v2.json.Formats._ import mesosphere.marathon.event._ import mesosphere.marathon.event.http.SubscribersKeeperActor.GetSubscribers -import play.api.libs.json.{ JsValue, Json } -import spray.client.pipelining.{ sendReceive, _ } -import spray.http.{ HttpRequest, HttpResponse } +import spray.client.pipelining.{sendReceive, _} +import spray.http.{HttpRequest, HttpResponse} import spray.httpx.PlayJsonSupport -import mesosphere.marathon.api.v2.json.Formats._ import scala.concurrent.Future -import scala.util.{ Failure, Success } +import scala.util.{Failure, Success} class HttpEventActor(val subscribersKeeper: ActorRef) extends Actor with ActorLogging with PlayJsonSupport { @@ -45,10 +44,9 @@ class HttpEventActor(val subscribersKeeper: ActorRef) extends Actor with ActorLo response.onComplete { case Success(res) => if (res.status.isFailure) - log.warning(s"Failed to post $event to $urlString") - + log.warning(s"Post {} to {} resulted in error response {}", event, urlString, res.status) case Failure(t) => - log.warning(s"Failed to post $event to $urlString", t) + log.warning("Failed to post {} to {} reason: {}", event, urlString, t) } } } diff --git a/src/main/scala/mesosphere/marathon/event/http/HttpEventStreamHandleActor.scala b/src/main/scala/mesosphere/marathon/event/http/HttpEventStreamHandleActor.scala index cafe4a75d09..2532635eeed 100644 --- a/src/main/scala/mesosphere/marathon/event/http/HttpEventStreamHandleActor.scala +++ b/src/main/scala/mesosphere/marathon/event/http/HttpEventStreamHandleActor.scala @@ -76,11 +76,11 @@ class HttpEventStreamHandleActor( //Do not act any longer on any event. context.become(Actor.emptyBehavior) case _ => - log.warning(s"Could not send message to $handle", ex) + log.warning("Could not send message to {} reason: {}", handle, ex) } private[this] def dropEvent(event: MarathonEvent): Unit = { - log.warning(s"Ignore event $event for handle $handle (slow consumer)") + log.warning("Ignore event {} for handle {} (slow consumer)", event, handle) } } diff --git a/src/main/scala/mesosphere/marathon/event/http/SubscribersKeeperActor.scala b/src/main/scala/mesosphere/marathon/event/http/SubscribersKeeperActor.scala index 2fde0486b81..6fa4e216fc1 100644 --- a/src/main/scala/mesosphere/marathon/event/http/SubscribersKeeperActor.scala +++ b/src/main/scala/mesosphere/marathon/event/http/SubscribersKeeperActor.scala @@ -20,7 +20,7 @@ class SubscribersKeeperActor(val store: EntityStore[EventSubscribers]) extends A val subscription: Future[MarathonSubscriptionEvent] = addResult.map { subscribers => if (subscribers.urls.contains(callbackUrl)) - log.info("Callback [%s] subscribed." format callbackUrl) + log.info("Callback {} subscribed.", callbackUrl) event } @@ -32,7 +32,7 @@ class SubscribersKeeperActor(val store: EntityStore[EventSubscribers]) extends A val subscription: Future[MarathonSubscriptionEvent] = removeResult.map { subscribers => if (!subscribers.urls.contains(callbackUrl)) - log.info("Callback [%s] unsubscribed." format callbackUrl) + log.info("Callback {} unsubscribed.", callbackUrl) event } @@ -48,7 +48,7 @@ class SubscribersKeeperActor(val store: EntityStore[EventSubscribers]) extends A store.modify(Subscribers) { deserialize => val existingSubscribers = deserialize() if (existingSubscribers.urls.contains(callbackUrl)) { - log.info("Existing callback [%s] resubscribed." format callbackUrl) + log.info("Existing callback {} resubscribed.", callbackUrl) existingSubscribers } else EventSubscribers(existingSubscribers.urls + callbackUrl) @@ -62,7 +62,7 @@ class SubscribersKeeperActor(val store: EntityStore[EventSubscribers]) extends A EventSubscribers(existingSubscribers.urls - callbackUrl) else { - log.warning("Attempted to unsubscribe nonexistent callback [%s]." format callbackUrl) + log.warning("Attempted to unsubscribe nonexistent callback {}", callbackUrl) existingSubscribers } }