From fbe3ac7a30f6d045673522f3a7290356f182a83b Mon Sep 17 00:00:00 2001 From: vlad Date: Fri, 23 Sep 2016 13:35:43 -0700 Subject: Rest service debug info --- src/main/scala/com/drivergrp/core/app.scala | 6 ++++++ src/main/scala/com/drivergrp/core/rest.scala | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/main/scala') diff --git a/src/main/scala/com/drivergrp/core/app.scala b/src/main/scala/com/drivergrp/core/app.scala index 8018ab4..53f30ba 100644 --- a/src/main/scala/com/drivergrp/core/app.scala +++ b/src/main/scala/com/drivergrp/core/app.scala @@ -68,6 +68,8 @@ object app { // TODO: extract `requestUuid` from request or thread, provided by linkerd/zipkin def requestUuid = java.util.UUID.randomUUID.toString + is.printStackTrace() + log.debug(s"Request is not allowed to $uri ($requestUuid)", is) complete( HttpResponse(BadRequest, @@ -79,6 +81,8 @@ object app { // TODO: extract `requestUuid` from request or thread, provided by linkerd/zipkin def requestUuid = java.util.UUID.randomUUID.toString + cm.printStackTrace() + log.debug(s"Concurrent modification of the resource $uri ($requestUuid)", cm) complete( HttpResponse(Conflict, @@ -90,6 +94,8 @@ object app { // TODO: extract `requestUuid` from request or thread, provided by linkerd/zipkin def requestUuid = java.util.UUID.randomUUID.toString + t.printStackTrace() + log.error(s"Request to $uri could not be handled normally ($requestUuid)", t) complete( HttpResponse(InternalServerError, diff --git a/src/main/scala/com/drivergrp/core/rest.scala b/src/main/scala/com/drivergrp/core/rest.scala index 753fda6..44c7211 100644 --- a/src/main/scala/com/drivergrp/core/rest.scala +++ b/src/main/scala/com/drivergrp/core/rest.scala @@ -59,27 +59,25 @@ object rest { log.audit(s"Sending to ${request.uri} request $request") - Console.print("(((((((((((") - val responseEntity = Http()(actorSystem).singleRequest(request)(materializer) map { response => if(response.status.isFailure() && response.status != StatusCodes.NotFound) { - Console.print(")))))))))") + log.audit(")))))))))") throw new Exception("Http status is failure " + response.status) } else { - Console.print("OOOOOOOOOOOO") + log.audit("OOOOOOOOOOOO") Unmarshal(response.entity.transformDataBytes(decryptionFlow)) } } responseEntity.onComplete { case Success(r) => - Console.print("1111111111111") + log.audit("1111111111111") val responseTime = time.currentTime() log.audit(s"Response from ${request.uri} to request $requestStub is successful") stats.recordStats(Seq("request", request.uri.toString, "success"), TimeRange(requestTime, responseTime), 1) case Failure(t: Throwable) => - Console.print("2222222222222") + log.audit("2222222222222") val responseTime = time.currentTime() log.audit(s"Failed to receive response from ${request.uri} to request $requestStub") log.error(s"Failed to receive response from ${request.uri} to request $requestStub", t) -- cgit v1.2.3