diff --git a/webapi/src/main/resources/logback.xml b/webapi/src/main/resources/logback.xml index a2b4b9b983..ed89b33aa0 100644 --- a/webapi/src/main/resources/logback.xml +++ b/webapi/src/main/resources/logback.xml @@ -38,6 +38,7 @@ + diff --git a/webapi/src/main/scala/org/knora/webapi/routing/AroundDirectives.scala b/webapi/src/main/scala/org/knora/webapi/routing/AroundDirectives.scala index 321557b9e2..af2e23e31f 100644 --- a/webapi/src/main/scala/org/knora/webapi/routing/AroundDirectives.scala +++ b/webapi/src/main/scala/org/knora/webapi/routing/AroundDirectives.scala @@ -21,10 +21,9 @@ trait AroundDirectives extends InstrumentationSupport { def logDuration: Directive0 = extractRequestContext.flatMap { ctx => val start = System.currentTimeMillis() mapResponse { resp => - val took = System.currentTimeMillis() - start - metricsLogger.info( - s"[${resp.status.intValue()}] ${ctx.request.method.name} " + s"${ctx.request.uri} took: ${took}ms" - ) + val took = System.currentTimeMillis() - start + val message = s"[${resp.status.intValue()}] ${ctx.request.method.name} ${ctx.request.uri} took: ${took}ms" + if (resp.status.isFailure()) metricsLogger.warn(message) else metricsLogger.debug(message) resp } }