You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I upgraded from the previous version of the project io.github.microutils and noticed that I could not make work Exception logging work when using logstash-logback-encoder (version 7.0.4).
I tried with a small Micronaut Project with Kotlin adding these 2 dependencies:
package example.micronaut
import io.github.oshai.kotlinlogging.KotlinLogging
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Get
val log = KotlinLogging.logger {}
@Controller
open class HomeController() {
@Get
fun index(): Map<String, String> {
try {
throw Exception("Issue with my code")
} catch (e: Exception) {
log.error(e) { "Error with stacktrace" }
log.error { "Error without stacktrace" }
}
log.info { "Back to the main code" }
return mapOf("message" to "Hello World")
}
}
Output:
{"message":"Error without stacktrace","logger_name":"example.micronaut.HomeController","level":"ERROR"}
{"message":"Back to the main code","logger_name":"example.micronaut.HomeController","level":"INFO"}
It works fine is using the default ch.qos.logback.core.ConsoleAppender.
Am I doing something wrong?
The text was updated successfully, but these errors were encountered:
Hello,
I upgraded from the previous version of the project
io.github.microutils
and noticed that I could not make work Exception logging work when using logstash-logback-encoder (version 7.0.4).I tried with a small Micronaut Project with Kotlin adding these 2 dependencies:
Logback Config:
Controller
Output:
It works fine is using the default
ch.qos.logback.core.ConsoleAppender
.Am I doing something wrong?
The text was updated successfully, but these errors were encountered: