Skip to content

Commit

Permalink
fix: Allow warn logging for requests which are failures, ensure debug…
Browse files Browse the repository at this point in the history
… logging level for all other requests (DEV-1255)
  • Loading branch information
seakayone committed Nov 2, 2022
1 parent b359916 commit f482cf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions webapi/src/main/resources/logback.xml
Expand Up @@ -38,6 +38,7 @@
<logger name="org.knora.webapi.util.cache" level="INFO"/>
<logger name="org.knora.webapi.util.PermissionUtilADM" level="INFO"/>
<logger name="org.knora.webapi.update.UpdateRepository" level="INFO"/>
<logger name="org.knora.webapi.routing.AroundDirectives" level="INFO"/>
<logger name="org.knora.webapi.routing.Authenticator" level="INFO"/>
<logger name="org.knora.webapi.routing.JWTHelper" level="INFO"/>
<logger name="org.knora.webapi.routing.v1.AssetsRouteV1" level="INFO"/>
Expand Down
Expand Up @@ -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} " + s"${ctx.request.uri} took: ${took}ms"
if (resp.status.isFailure()) metricsLogger.warn(message) else metricsLogger.debug(message)
resp
}
}
Expand Down

0 comments on commit f482cf8

Please sign in to comment.