logzio / logzio-log4j2-appender

Log4j2 Appender that ships logs using HTTPs bulk
Apache License 2.0
9 stars 11 forks source link

Logzio appender is stopped on Log4j2 reconfigure #38

Closed idachev closed 3 years ago

idachev commented 3 years ago

I hit an issue that causes the Logzio appended to not work.

Immediate on spring boot start the Log4j2 is reconfigured - but the reconfiguration workflow is this:

  1. Start new Log4j2 configuration
  2. Start all new appenders
  3. Stop old Log4j2 configuration
  4. Stop all old appenders - here Logzio appended is shutdown forever

These are the logs:

Log4j2 config first starting appender:       ===> 2021-01-26 04:30:34,665 main INFO DEBUG: Created new LogzioSender class                                                                                                                                            
First logs send to Logzio                    ===> 2021-01-26 04:30:34,667 Log4j2-TF-2-LogzioAppender-1 INFO DEBUG: Attempting to drain queue                                                                                                                         
Log4j2 config second time starting appender: ===> 2021-01-26 04:30:35,288 main INFO Already found appender configured for type local, re-using the same one.                                                                                                         
Next logs send to Logzio                     ===> 2021-01-26 04:30:35,288 Log4j2-TF-2-LogzioAppender-3 INFO DEBUG: Attempting to drain queue                                                                                                                         
Log4j2 old config stoping appender:          ===> 2021-01-26 04:30:35,289 main INFO DEBUG: Got stop request, Submitting a final drain queue task to drain before shutdown. Will timeout in 20 seconds.                                                               
Last logs send to Logzio                     ===> 2021-01-26 04:30:35,290 pool-6-thread-1 INFO DEBUG: Attempting to drain queue 
idachev commented 3 years ago

I successfully fixed the issue please review the code: https://github.com/logzio/logzio-log4j2-appender/pull/39