Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow warn logging for requests which are failures, ensure debug… #2273

Merged
merged 2 commits into from Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"
seakayone marked this conversation as resolved.
Show resolved Hide resolved
if (resp.status.isFailure()) metricsLogger.warn(message) else metricsLogger.debug(message)
resp
}
}
Expand Down