No Logstash Output with Spring Boot 3

192 views Asked by At

I have the following dependencies:

  • logstash-logback-encoder:7.4
  • spring-boot:3.1.6
  • logback-core:1.4.11

I have a logback-spring.xml configuration:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
    <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>

    <appender name="LOGSTASH" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
    </appender>
    
    <springProfile name="test">
        <root level="INFO">
            <appender-ref ref="LOGSTASH"/>
        </root>
    </springProfile>

When I start my Spring boot application with the test profile I get no output at all. If I replace the encoder with a custom pattern, everything gets logged. What could be wrong with my config? How can I debug this?

1

There are 1 answers

1
user15110545 On

Solved the error. Turns out, I had an jaxb dependency in my classpath that somehow conflicted with this setup.