Hello,

I am attempting to use a kafka log appender. The topic is written to Kafka but 
the appender breaks during the messaging.

org.apache.kafka.common.errors.SerializationException: Can't convert value of 
class [B to class org.apache.kafka.common.serialization.StringSerializer 
specified in value.serializer

I had seen only one SO post about this error which seems to point to Spring as 
the culprit but I am not using Spring.

http://stackoverflow.com/questions/32368372/spring-integration-kafka-sending-a-basic-string

I am running this in IntelliJ without any Spring configuration. The log4j2.xml 
file is as follows (with modification to the Kafka host).

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
  <Appenders>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - 
%msg%n"/>
    </Console>
   <Kafka name="Kafka" topic="log-test">
      <PatternLayout pattern="%date %message"/>
        <Property name="bootstrap.servers">localhost:9092</Property>
        <Property name="key.class.type">java.lang.String</Property>
        <Property name="value.class.type">java.lang.String</Property>
        <Property 
name="key.serializer">org.apache.kafka.common.serialization.StringSerializer</Property>
        <Property 
name="value.serializer">org.apache.kafka.common.serialization.StringSerializer</Property>
    </Kafka>
  </Appenders>
  <Loggers>
    <Root level="DEBUG">
      <AppenderRef ref="Kafka"/>
    </Root>
    <Logger name="org.apache.kafka" level="INFO" >
      <AppenderRef ref="Kafka"/>
    </Logger>
    <!-- avoid recursive logging/ haven't tried OFF yet -->
  </Loggers>
</Configuration>


The test I am doing is



private static final Logger logger = LogManager.getRootLogger();

logger.info("{\"f1\": \"value1\"}");



I just downloaded the source to log4j2 to see if this will help me understand 
what is happening but perhaps this obvious to someone in this community?



Any pointers would be very helpful and appreciated.





Thanks

Meadowlark Bradsher







Reply via email to