1

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?

Pantelisy
  • 73
  • 8
  • You need to define spring.kafka.consumer.bootstrap-servers in you application. yml – pringi Apr 06 '22 at 19:42
  • You mean in application.properties of my spring application? I tried that and still got the same error. Also, as i mentioned in my description with version 2.6.4 my current configuration is working without errors – Pantelisy Apr 06 '22 at 19:47
  • Can you check if the Log4J2 version has been updated between the two boot versions? – Tomaz Fernandes Apr 08 '22 at 16:58
  • The log4j2-kafka-appender has in did updated from 3.0.0 to 3.0.1 . Although, I exclusively have the 3.1.0 version which is the latest version of this artifact – Pantelisy Apr 08 '22 at 17:22
  • Can you try using the provided version 3.0.1 to see if that solves the problem? – Tomaz Fernandes Apr 08 '22 at 22:56
  • @TomazFernandes I tried to use both 3.0.1 and 3.0.0 version of Kafka-log4j-appender artifact in dependencyManagement section but the issue persists. I still don't get it why even if I set the value field the rawvalue is getting populated? – Pantelisy Apr 09 '22 at 17:50
  • I’m not really familiar with these appenders. The way you put it, looks like a Spring Boot problem. Maybe if no one can help you here in a couple of days, you can open an issue in boot’s GitHub, they might be able to help you there. – Tomaz Fernandes Apr 09 '22 at 18:52
  • 1
    Thank you a lot! I will keep you posted if I open an issue in the GitHub – Pantelisy Apr 09 '22 at 19:14

0 Answers0