logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: Kafka appender expecting String but getting Byte?
Date Sat, 06 Aug 2016 01:06:53 GMT
Also, also, you can try building our Git master branch which uses Kafka
0.10.0.0 instead of 0.9.0.1

Gary

On Fri, Aug 5, 2016 at 6:04 PM, Gary Gregory <garydgregory@gmail.com> wrote:

> Also, try omitting these properties:
>
>         <Property name="key.serializer">org.apache.kafka.common.
> serialization.StringSerializer</Property>
>         <Property name="value.serializer">org.apache.kafka.common.
> serialization.StringSerializer</Property>
>
> Gary
>
> On Fri, Aug 5, 2016 at 6:02 PM, Gary Gregory <garydgregory@gmail.com>
> wrote:
>
>> Do you get a stack trace with the exception?
>>
>> Gary
>>
>> On Fri, Aug 5, 2016 at 11:03 AM, Meadowlark Bradsher <
>> mbradsher@guidewire.com> wrote:
>>
>>> 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-integrati
>>> on-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.apac
>>> he.kafka.common.serialization.StringSerializer</Property>
>>>         <Property name="value.serializer">org.ap
>>> ache.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
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message