How can I configure Groovy's Slf4j/Logback integration to forward only error-level alerts to a monitoring system while ignoring info and debug logs?
0 reputation · 09 Sept 2021, 05:23 UTC
I am building a Groovy microservice that logs via Slf4j backed by Logback. The service ships logs to a central monitoring system that triggers alerts on any received message. Currently, every INFO and DEBUG log also creates an alert, flooding the channel and obscuring genuine problems. I need to keep the alerting mechanism active for real failures while suppressing the lower‑level logs that generate noise.
Given this setup, what configuration can I apply to the Logback appender so that only ERROR (and possibly FATAL) level events are forwarded to the alerting endpoint? How can I verify that the filter does not inadvertently drop error logs during normal operation? Is there a recommended way to test the filter locally before deploying to production?