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?
Comment From: scottfrederick
It does not appear that Spring Boot is involved in the problem you are having, since a log4j2.properties file will be parsed by Log4j2 itself.
If you are using Spring Boot's dependency management, with 2.6.4 you will get Log4j2 version 2.17.1 and Kafka (including org.apache.kafka:kafka-log4j-appender) version 3.0.0. With 2.6.6 you will get Log4j2 version 2.17.2 and Kafka version 3.0.1. You can follow the Spring Boot instructions for customizing dependency versions to set the Log4j2 and Kafka versions in your Boot 2.6.6 app to the older versions used by 2.6.4 and narrow the problem down to the appropriate library.