I'm trying to configure a micronaut app to produce logs in json format. I found ways to configure the underlying logback to do that ([1]), but I'm wondering if it could also be done via Micronaut's configuration.
Does micronaut framework support configuring logs as json?
Yes.
See the project at https://github.com/jeffbrown/miguelferreirajsonlogback.
runtimeOnly("ch.qos.logback.contrib:logback-json-classic:0.1.5")
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.contrib.json.classic.JsonLayout">
<jsonFormatter
class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter">
<prettyPrint>true</prettyPrint>
</jsonFormatter>
<timestampFormat>yyyy-MM-dd' 'HH:mm:ss.SSS</timestampFormat>
</layout>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>