[ https://issues.apache.org/jira/browse/KAFKA-15783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17782928#comment-17782928 ]
Diego Pettisani edited comment on KAFKA-15783 at 11/4/23 9:33 PM: ------------------------------------------------------------------ Sorry, only now I verified that we can modify {{linger.ms}} and {{batch.size}} in this way: {code:xml} <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> <Property name="linger.ms">30</Property> <Property name="batch.size">16384</Property> </Kafka> {code} I try to close this issue. Thanks at all was (Author: diepet): Sorry, only now I verified that we can modify {{ linger.ms}} and {{batch.size}} in this way: {code:xml} <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> <Property name="linger.ms">30</Property> <Property name="batch.size">16384</Property> </Kafka> {code} I try to close this issue. Thanks at all > 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)