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

Diego Pettisani commented on KAFKA-15783:
-----------------------------------------

Please note that I receive the same error if I try to set the {{lingerMs}} 
parameter too.

With this configuration:

{code:xml}
<Kafka name="Kafka" topic="log-collector" syncSend="false" lingerMs="10" 
batchSize="8192">
{code}

the application logs this:

{code}
ERROR StatusConsoleListener Kafka contains invalid attributes "lingerMs", 
"batchSize"
{code}


> Unable to set batchSize in log4j2 Kafka appender
> ------------------------------------------------
>
>                 Key: KAFKA-15783
>                 URL: https://issues.apache.org/jira/browse/KAFKA-15783
>             Project: Kafka
>          Issue Type: Bug
>          Components: logging
>    Affects Versions: 3.6.0
>            Reporter: Diego Pettisani
>            Priority: Minor
>
> When I try to configure the batchSize of the Kafka log4j2 appender the 
> application logs the following error:
> {noformat}
> ERROR StatusConsoleListener Kafka contains an invalid element or attribute 
> "batchSize"
> {noformat}
> This is an example of configuration that fails:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="WARN">
>       <Appenders>
>               <Console name="LogToConsole" target="SYSTEM_OUT">
>                       <PatternLayout
>                               pattern="%d{HH:mm:ss.SSS} [%t] %-5level 
> %logger{36} - %msg%n" />
>               </Console>
>               <Kafka name="Kafka" topic="log-collector" syncSend="false"
>                       batchSize="8192">
>                       <PatternLayout
>                               pattern="%d{HH:mm:ss.SSS} [%t] %-5level 
> %logger{36} - %msg%n" />
>                       <Property 
> name="bootstrap.servers">localhost:9092</Property>
>               </Kafka>
>       </Appenders>
>       <Loggers>
>               <Root level="info">
>                       <AppenderRef ref="LogToConsole" />
>                       <AppenderRef ref="Kafka" />
>               </Root>
>               <Logger name="org.apache.kafka" level="WARN" /><!-- avoid 
> recursive
>               logging -->
>       </Loggers>
> </Configuration>
> {code}
> Please note that other parameters like {{syncSend}} work fine.
> Could be possible that log4j2 expects this field:
> https://github.com/apache/kafka/blob/3.6.0/log4j-appender/src/main/java/org/apache/kafka/log4jappender/KafkaLog4jAppender.java#L83C11-L83C11
> as a String for working fine?



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

Reply via email to