From c71e402cee010d8cbc6e8119c8fb96367d085aa9 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 13 Mar 2017 23:38:32 -0700 Subject: Added writing tracking Id to MDC so it can be logged for all messages, removed some linkerd legacy and refined Revision equals --- src/main/scala/xyz/driver/core/app.scala | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/main/scala/xyz') diff --git a/src/main/scala/xyz/driver/core/app.scala b/src/main/scala/xyz/driver/core/app.scala index 5a1b803..ceaf772 100644 --- a/src/main/scala/xyz/driver/core/app.scala +++ b/src/main/scala/xyz/driver/core/app.scala @@ -95,27 +95,23 @@ object app { case is: IllegalStateException => ctx => - val trackingId = Option(MDC.get("trackingId")).getOrElse(rest.extractTrackingId(ctx.request)) - log.error(s"Request is not allowed to ${ctx.request.uri} ($trackingId)", is) + log.error(s"Request is not allowed to ${ctx.request.uri}", is) complete(HttpResponse(BadRequest, entity = is.getMessage))(ctx) case cm: ConcurrentModificationException => ctx => - val trackingId = Option(MDC.get("trackingId")).getOrElse(rest.extractTrackingId(ctx.request)) - log.error(s"Concurrent modification of the resource ${ctx.request.uri} ($trackingId)", cm) + log.error(s"Concurrent modification of the resource ${ctx.request.uri}", cm) complete( HttpResponse(Conflict, entity = "Resource was changed concurrently, try requesting a newer version"))(ctx) case sex: SQLException => ctx => - val trackingId = Option(MDC.get("trackingId")).getOrElse(rest.extractTrackingId(ctx.request)) - log.error(s"Database exception for the resource ${ctx.request.uri} ($trackingId)", sex) + log.error(s"Database exception for the resource ${ctx.request.uri}", sex) complete(HttpResponse(InternalServerError, entity = "Data access error"))(ctx) case t: Throwable => ctx => - val trackingId = Option(MDC.get("trackingId")).getOrElse(rest.extractTrackingId(ctx.request)) - log.error(s"Request to ${ctx.request.uri} could not be handled normally ($trackingId)", t) + log.error(s"Request to ${ctx.request.uri} could not be handled normally", t) complete(HttpResponse(InternalServerError, entity = t.getMessage))(ctx) } -- cgit v1.2.3