https://kotlinlang.org logo
#ktor
Title
# ktor
s

Sean Abbott

06/24/2021, 2:10 PM
Hello, I'm trying to get call logging to work with my new ktor application. Is the logback line ABSOLUTELY necessary? My more-java-and-kotlin-experienced coworkers don't want to add logback into our dependencies they want everything to go through slf4j, so right now I'm not getting any trace prints about calls that the server receives. So far I'm just using the netty engine. I followed the tutorial, and (simplified) I have:
Copy code
fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)

fun Application.module(testing: Boolean = false) {
    install(ContentNegotiation) {
        json()
    }
    install(CallLogging)
    registerAccountRoutes()
    registerHealthRoutes()
}
The install ContentNegotiation works, but CallLogging isn't doing anything as far as I can tell.
ooops, never mind, moved the call logging into the register extention function and now it's working.
2 Views