hdarritchon
05/23/2019, 3:30 PMinstall(CallLogging) {
level = <http://Level.INFO|Level.INFO>
filter { call -> call.request.path().startsWith("/api/v1") }
callIdMdc()
}
And I have some logs like : 200 OK: GET - /api/v1/health
but I’d like to have more details like the header and body because in some case I have log like Unhandled: POST - /api/v1/catalogEdito/reunion/store
whereas this endpoint exists and returns some datas for certain type of client. So I think I need to have more details to debug and understand what is going on !
Do you know how I can do it please ?Jonathan Mew
05/23/2019, 3:37 PMmdc(LoggingKey("header")) {
call: ApplicationCall -> call.request.header("someHeaderName")
}
Jonathan Mew
05/23/2019, 3:41 PMJonathan Mew
05/23/2019, 3:42 PMhdarritchon
05/24/2019, 1:43 PMinstall(CallLogging) {
level = <http://Level.INFO|Level.INFO>
filter { call -> call.request.path().startsWith("/api/v1") }
callIdMdc()
requestHeadersMdc()
}
fun CallLogging.Configuration.requestHeadersMdc(name: String = "Headers") {
mdc(name) { call ->
call.request.headers.entries()
.map {
it.key to it.value.joinToString(",")
}.joinToString(";") {
"${it.first}:${it.second}"
}
}
}