Spring boot log settings in application.yml

Viewed 5530

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:

  • How do I specify the ROOT log level properly in application.yml?
  • How do I specify logstash encoder properly in application.yml?
1 Answers
Related