Logback warns not working post upgrade to 3.x.x

I was recently debugging why warnings weren’t showing up in Sentry and narrowed it down to our upgrade from sentry-logback from 1.7.30 to 3.1.0.

As far as I can tell, even though our configuration did not change, this upgrade stopped creating Sentry events from the instances of log.warn in our codebase. We upgraded, didn’t notice this, and continued to upgrade up to 3.2.0. I’ve since pulled everything back to 1.7.30 and it works again.

What do I need to change about our configuration to fix warnings for the new versions of the library?

I’ve read the release notes and current docs, but I don’t see any obvious migration steps. Here is what our logback configuration currently looks like:

<configuration>
    <include resource="org/springframework/boot/logging/logback/base.xml"/>
    <appender name="SENTRY" class="io.sentry.logback.SentryAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>WARN</level>
        </filter>
    </appender>

    <root level="INFO">
        <appender-ref ref="CONSOLE"/>
        <appender-ref ref="FILE"/>
        <appender-ref ref="SENTRY"/>
    </root>
</configuration>

If you want to view further details about our setup I actually blogged about, https://dev.to/focusedlabs/sentry-with-spring-boot-the-better-way-9kl.

As you can see the Sentry appended should be getting WARNs and above, but these messages never hit Sentry post 3.x.x. How do I fix this?

If this looks like an issue with the Sentry library vs a misconfiguration on my side I am happy to move this topic over to a Github issue.

By default events are only sent for level ERROR or higher. INFO or higher are kept in the ring buffer as breadcrumbs, so you can see the N log entries for that scope.

To change to send WARN to Sentry as events, check out the docs:

1 Like

Thanks for the answer. I was looking through docs but missed the config change.

The breaking change was getting rid of filter and replacing it with minimumEventLevel.

    <appender name="SENTRY" class="io.sentry.logback.SentryAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>WARN</level>
        </filter>
    </appender>

becomes

    <appender name="SENTRY" class="io.sentry.logback.SentryAppender">
        <minimumEventLevel>WARN</minimumEventLevel>
    </appender>
1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.