<div dir="ltr">Hello,<div><br></div><div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;line-height:21px">I have a spring boot application that uses <code style="font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;padding:0.2em 0px;margin:0px;border-radius:3px;background-color:rgba(0,0,0,0.0392157)">logback-spring.xml</code> to configure console or file appenders and logstash appender added programmatically because it requires dynamic properties from my application.</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;line-height:21px">It works well on app startup, but when I modify log level in <code style="font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;padding:0.2em 0px;margin:0px;border-radius:3px;background-color:rgba(0,0,0,0.0392157)">logback-spring.xml</code> the <code style="font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;padding:0.2em 0px;margin:0px;border-radius:3px;background-color:rgba(0,0,0,0.0392157)">LoggerContext</code> is reset and only the static configuration from <code style="font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;padding:0.2em 0px;margin:0px;border-radius:3px;background-color:rgba(0,0,0,0.0392157)">logback-spring.xml</code> is reloaded and so the logstash appender is no longer used.</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;line-height:21px">Behavior is the same with plain logback.xml</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;line-height:21px">So far, the only workaround I found is to add a <code style="font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;padding:0.2em 0px;margin:0px;border-radius:3px;background-color:rgba(0,0,0,0.0392157)">LoggerContextListener</code> that adds logstash appender on reset event. It works but I wonder whether this is the best way.</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;line-height:21px">I also thought of adding a listener to ReconfigureOnChangeTask but the <span style="color:rgb(121,93,163);font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;white-space:pre">addListener() method is package protected.</span></p><p style="margin-top:0px;margin-bottom:16px"><span style="color:rgb(121,93,163);font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;white-space:pre">I am using logback-classic </span><font color="#795da3" face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:12px;line-height:20px;white-space:pre">1.1.7 and spring-boot 1.4.0.</span></font></p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;line-height:21px"><span style="color:rgb(121,93,163);font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;white-space:pre">Thanks,</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal"> </span></p><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Gaël Marziou<div><br></div></div></div>
</div></div>