[ 
https://issues.apache.org/jira/browse/LOG4J2-3563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17572264#comment-17572264
 ] 

Sergey Kadaner commented on LOG4J2-3563:
----------------------------------------

[~rgoers] I have the {_}log4j2.Script.enabes{_}{_}leLanguag{_}{_}=Groovy{_} in 
my _log4j2.component.properties_ file and I also tried adding it as a JVM 
parameter via -D{_}log4j2.Script.enableLanguages=Groovy{_}

Is not it the correct configuration?

> Logging to Kafka is broken 
> ---------------------------
>
>                 Key: LOG4J2-3563
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3563
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.18.0, 2.17.2, 2.17.3
>            Reporter: Sergey Kadaner
>            Priority: Blocker
>
> Upgrading from Log4J2 2.17.1 to 2.17.2 broke our logging to Kafka.
> We have the following configuration:
> {code:yaml}
> AppenderSet: 
>   kafka: 
>     name: kafka
>     topic: logs
>     syncsend: false
>     ignoreExceptions: true
>     PatternLayout: 
>       Pattern: "{\"service_name\":\"${env:SERVICE_NAME}..."
>     Property: 
>       - name: bootstrap.servers
>         value: ${env:KAFKA_BOOTSTRAP_SERVERS} {code}
> After upgrading to 2.17.2 we are getting the following error on startup:
> {noformat}
> 2022-07-26 19:12:42,674 main ERROR Could not create plugin of type class 
> org.apache.logging.log4j.core.appender.ScriptAppenderSelector for element 
> ScriptAppenderSelector: org.apache.kafka.common.KafkaException: Failed to 
> construct kafka producer org.apache.kafka.common.KafkaException: Failed to 
> construct kafka producer
>     at 
> org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:442)
>     at 
> org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:292)
>     at 
> org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:319)
>     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:136)
>     at 
> org.apache.logging.log4j.core.appender.mom.kafka.KafkaAppender.start(KafkaAppender.java:195)
>     at 
> org.apache.logging.log4j.core.appender.AppenderSet.createAppender(AppenderSet.java:129)
>     at 
> org.apache.logging.log4j.core.appender.ScriptAppenderSelector$Builder.build(ScriptAppenderSelector.java:96)
>     at 
> org.apache.logging.log4j.core.appender.ScriptAppenderSelector$Builder.build(ScriptAppenderSelector.java:46)
>     at 
> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:124)
>     at 
> org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1122)
>     at 
> org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1047)
>     at 
> org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1039)
>     at 
> org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:651)
>     at 
> org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:249)
>     at 
> org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:295)
>     at 
> org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
>     at 
> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:694)
>     at 
> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:711)
>     at 
> org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:253)
>     at 
> org.apache.logging.log4j.core.async.AsyncLoggerContext.start(AsyncLoggerContext.java:76)
>     at 
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
>     at 
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
>     at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
>     at 
> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:137)
>     at 
> org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:55)
>     at 
> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
>     at 
> org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
>     at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
>     at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
>     at com.mycompany.MyApplication.<clinit>(MyApplication.java:8)
> Caused by: org.apache.kafka.common.config.ConfigException: No resolvable 
> bootstrap urls given in bootstrap.servers
>     at 
> org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:89)
>     at 
> org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:48)
>     at 
> org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:416)
>     ... 31 more
> {noformat}
> Replacing the environment variable with a hardcoded "bootstrap.servers" value 
> changes nothing.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to