[logback-user] Reconfiguration with file configuration and programmatic configuration

Gaël Marziou gael.marziou at gmail.com
Tue Aug 23 20:52:16 UTC 2016


I have a spring boot application that uses logback-spring.xml to configure
console or file appenders and logstash appender added programmatically
because it requires dynamic properties from my application.

It works well on app startup, but when I modify log level in
logback-spring.xml the LoggerContext is reset and only the static
configuration from logback-spring.xml is reloaded and so the logstash
appender is no longer used.

Behavior is the same with plain logback.xml

So far, the only workaround I found is to add a LoggerContextListener that
adds logstash appender on reset event. It works but I wonder whether this
is the best way.

I also thought of adding a  listener to ReconfigureOnChangeTask but
the addListener()
method is package protected.

I am using logback-classic 1.1.7 and spring-boot 1.4.0.

Gaël Marziou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20160823/be5aa09a/attachment.html>

More information about the logback-user mailing list