logback-kafka-appender icon indicating copy to clipboard operation
logback-kafka-appender copied to clipboard

AutoScan not working with Appender properties

Open VidhyaKailash opened this issue 7 years ago • 2 comments

I am trying to use the TurboFiltercalled ReconfigureOnChangeFilter to change the properties of appender like broker and topic and they wouldnt take effect with the KafkaAppender. http://logback.qos.ch/manual/configuration.html#autoScan <configuration scan="true" scanPeriod="30 seconds" >

Can somebody please point me to how I can implement this quickly for the Kafka Appender. We have an environment where we might need to change the brokers or topicname maybe not so frequently, but preferably without restarting the server.

thanks Vidhya

VidhyaKailash avatar Dec 09 '16 14:12 VidhyaKailash

I am not really sure how the ReconfigureOnChangeFilter works, i.e. if if really reinitializes the logging context using reset (in that case, the kafka appender should naturally work) or if it simply reapplies all properties to the existing appender. It the latter case what could probably make it work would be to trigger a producer reinitialization on each producer configuration change (e.g. in com.github.danielwegener.logback.kafka.KafkaAppenderConfig#addProducerConfigValue). But since these changes are not all applied at once but one after another while joran fires its sax event listeners one would have to debounce the automatic appender reconfiguration. It would also be a clever idea to keep the old producer running until the new producer has collected meta data and is ready to deliver.

danielwegener avatar Feb 23 '17 23:02 danielwegener

Just dived into the code. A simple reset is not enough since it just stops all appenders but does not restart them. To reload the kafka producer, the whole configuration has to be reinitialized (using the JoranConfigurer path).

danielwegener avatar Mar 17 '17 16:03 danielwegener