title: Log4j2 kafka appender failover handling when all of Kafka Brokers are unavailable?
body: <p>I am sending all my application logs to the Kafka using Log4j2 Kafka appender and it works. But in a situation, when I purposefully bring down the broker, the application gets hung-up and the kafka appender keeps on retrying to establish the connection.</p>
  <p>How can I stop writing into Kafka when the broker(s) are down? and resume once it is available?</p>
  <p>Following is the appender configuration I have used.</p>
  <pre><code>&lt;Kafka name=&quot;KafkaServiceStatInfo&quot; topic=&quot;testKafkaLogs&quot;&gt;
                  &lt;PatternLayout pattern=&quot;%m&quot;/&gt;
              &lt;Property name=&quot;bootstrap.servers&quot;&gt;localhost:9092&lt;/Property&gt;
              &lt;Property name=&quot;acks&quot;&gt;0&lt;/Property&gt;
          &lt;/Kafka&gt;
          &lt;Async name=&quot;Async&quot;&gt;
              &lt;AppenderRef ref=&quot;KafkaServiceStatInfo&quot;/&gt;
          &lt;/Async&gt;
  </code></pre>