Is there a way to add a suffix/tag to logs based o...
# ktor
a
Is there a way to add a suffix/tag to logs based on which module/plugin/etc. is doing the logging? Right now it’s always
Application
a
Could you please explain what log messages are you talking about (on a client or a server)?
a
In a server, I’d like to see which module/plugin logged the line
Ideally without needing to add the tag manually to every slf4j call 🙂
I guess something like constructing a child logger from the one I got from the environment
f
You can tag your path
a
slf4j “marker” feature?
a
There is a brittle solution to implement your own
org.slf4j.Logger
where you can retrieve a calling class from the stack trace and log its name or its source file name. That will work on JVM only.
Copy code
ApplicationEngineEnvironmentReloading.kt: Autoreload is disabled because the development mode is off.
BaseApplicationEngine.kt: Application started in 0.095 seconds.
CallLogging.kt: Application started: io.ktor.server.application.Application@5b3f61ff
BaseApplicationEngine.kt: Responding at <http://0.0.0.0:3333>
server.kt: ewqe
CallLogging.kt: 200 OK: GET - /