1 year ago

#384158

test-img

Pantelisy

Spring boot 2.6.6 defect with Kafka appender

I want to upgrade my app in order to use the updated version of spring boot. Also, i am using log4j2 with a Kafka appender.

Although, when i upgrated to 2.6.6. version from 2.6.4 i had the following error:

ConfigException: No resolvable bootstrap urls given in bootstrap.servers

The configuration of my appender is the following:

appender.kafka.type=Kafka
appender.kafka.name=MyKafkaAppender
appender.kafka.layout.type=PatternLayout
appender.kafka.layout.pattern=<%.-1p %d{yyyyMMMdd HH:mm:ss.SSS}> %X{mdc} %m%n
appender.kafka.topic=my_topic
appender.kafka.property.type=Property
appender.kafka.property.name=bootstrap.servers
appender.kafka.property.value=0.0.0.0:9092

After some debugging i come across the following result:

Until version 2.6.4 the properties object was the following:

name: "bootstrap.servers"
value: "0.0.0.0:9092"
valueNeedsLookup: false

Although, in version 2.6.6 with the same configuration in log4j2.properties the properties object has this form:

name: "bootstrap.servers"
rawValue: "0.0.0.0:9092"
value: null
valueNeedsLookup: false

This is the reason i get the error i mentioned before.

My question is: Is there any way i can set the value field of the new structure? Also, is this structure expected?

spring

spring-boot

apache-kafka

log4j2

spring-kafka

0 Answers

Your Answer

Accepted video resources