Reputation: 1148
I'm building a spring boot application. I use logstash to create structured logs, and this works great. However, I'm trying to move the following logback.xml
to application.yml
.
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder" />
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>
I can't find any tutorial or example that comes remotely close to getting this in application.yml
.
furthermore I noticed the following. If I remove logback.xml
and put the following in application.yml
spring:
logging:
level:
ROOT: WARNING
According to this question, I should at least have control over my log level. No dice, info's getting logged all over the place.
So, questions:
application.yml
?application.yml
?Upvotes: 5
Views: 9364
Reputation: 36123
Root level can be configured like this:
logging:
level:
root: warning
But the encoder cannot be configured using properties or yaml. Please find all properties in the Spring Boot Reference Doc: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#common-application-properties
So there is no way around the logback xml file
Upvotes: 4