You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Artyom Krikheli (JIRA)" <ji...@apache.org> on 2019/07/18 14:59:00 UTC

[jira] [Updated] (LOG4J2-2656) Add possibility to ignore exception if kafka connection error occurred

     [ https://issues.apache.org/jira/browse/LOG4J2-2656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Artyom Krikheli updated LOG4J2-2656:
------------------------------------
    Description: 
Nowadays if we use a log4j2-Kafka-appender with Spring Boot framework and Kafka is unavailable for some reason, the application crashes. We may have several appenders (File appender, SYSOUT, etc) and I think that Kafka's inaccessibility is not a reason for the failure of an application.
{code:java}
Caused by: org.apache.kafka.common.KafkaException: Failed to construct kafka producer at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:457) at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:304) at org.apache.logging.log4j.core.appender.mom.kafka.DefaultKafkaProducerFactory.newKafkaProducer(DefaultKafkaProducerFactory.java:40) at org.apache.logging.log4j.core.appender.mom.kafka.KafkaManager.startup(KafkaManager.java:131) at org.apache.logging.log4j.core.appender.mom.kafka.KafkaAppender.start(KafkaAppender.java:175) at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:266) at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547) at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263) at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.loadConfiguration(Log4J2LoggingSystem.java:175)
{code}
I can offer to add a special boolean property to logger config named *ignoreKafkaConnectionError* and in depends on its value we can either catch kafka exceptions occurred while producer creating or not.

I have implemented this feature and have opened the pull request: [https://github.com/apache/logging-log4j2/pull/292]

  was:
Nowadays if we use a log4j2-Kafka-appender with Spring Boot framework and Kafka is unavailable for some reason, the application crashes. We may have several appenders (File appender, SYSOUT, etc) and I think that Kafka's inaccessibility is not a reason for the failure of an application.
{code:java}
Caused by: org.apache.kafka.common.KafkaException: Failed to construct kafka producer at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:457) at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:304) at org.apache.logging.log4j.core.appender.mom.kafka.DefaultKafkaProducerFactory.newKafkaProducer(DefaultKafkaProducerFactory.java:40) at org.apache.logging.log4j.core.appender.mom.kafka.KafkaManager.startup(KafkaManager.java:131) at org.apache.logging.log4j.core.appender.mom.kafka.KafkaAppender.start(KafkaAppender.java:175) at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:266) at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547) at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263) at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.loadConfiguration(Log4J2LoggingSystem.java:175)
{code}
I can offer to add a special boolean property to logger config named *ignoreKafkaConnectionError* and in depends on its value we can either catch kafka exceptions occurred while producer creating or not.

I have implemented this feature and have opened pull request: [https://github.com/apache/logging-log4j2/pull/292]


> Add possibility to ignore exception if kafka connection error occurred
> ----------------------------------------------------------------------
>
>                 Key: LOG4J2-2656
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2656
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Appenders
>    Affects Versions: 2.12.0
>            Reporter: Artyom Krikheli
>            Priority: Major
>
> Nowadays if we use a log4j2-Kafka-appender with Spring Boot framework and Kafka is unavailable for some reason, the application crashes. We may have several appenders (File appender, SYSOUT, etc) and I think that Kafka's inaccessibility is not a reason for the failure of an application.
> {code:java}
> Caused by: org.apache.kafka.common.KafkaException: Failed to construct kafka producer at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:457) at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:304) at org.apache.logging.log4j.core.appender.mom.kafka.DefaultKafkaProducerFactory.newKafkaProducer(DefaultKafkaProducerFactory.java:40) at org.apache.logging.log4j.core.appender.mom.kafka.KafkaManager.startup(KafkaManager.java:131) at org.apache.logging.log4j.core.appender.mom.kafka.KafkaAppender.start(KafkaAppender.java:175) at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:266) at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547) at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263) at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.loadConfiguration(Log4J2LoggingSystem.java:175)
> {code}
> I can offer to add a special boolean property to logger config named *ignoreKafkaConnectionError* and in depends on its value we can either catch kafka exceptions occurred while producer creating or not.
> I have implemented this feature and have opened the pull request: [https://github.com/apache/logging-log4j2/pull/292]



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)