Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 17E1B200B59 for ; Mon, 8 Aug 2016 10:20:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 16898160A91; Mon, 8 Aug 2016 08:20:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3A0CD160A8F for ; Mon, 8 Aug 2016 10:20:19 +0200 (CEST) Received: (qmail 38168 invoked by uid 500); 8 Aug 2016 08:20:18 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 38157 invoked by uid 99); 8 Aug 2016 08:20:18 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2016 08:20:18 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id CED34180E73 for ; Mon, 8 Aug 2016 08:20:17 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.229 X-Spam-Level: *** X-Spam-Status: No, score=3.229 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, KAM_INFOUSMEBIZ=0.75, KAM_LINEPADDING=1.2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=magine-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id V3LxAceLL-HA for ; Mon, 8 Aug 2016 08:20:14 +0000 (UTC) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id BC3DD5F232 for ; Mon, 8 Aug 2016 08:20:13 +0000 (UTC) Received: by mail-oi0-f53.google.com with SMTP id 4so228212971oih.2 for ; Mon, 08 Aug 2016 01:20:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=magine-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=lCRq/5YRMIPnSKdAvQ/xNtB9ljL4a/7uMo4ZKGjWMfM=; b=C75IFmSet8de+8WAI/Z8flP5xgsVL5YMSZ5LPTLsyg1YNC0X4ZXKzNLDCXr6O5EbRv yi6Sj0yvpFXm+QCt2nQQqOOr9i9tUBpGOPvCsHOw1Tatk1dDlmkwBnywAELy5xKxjXw4 D4m+FwRnMHr3HP1bDNAmjhhJ2DGglK5OOhfGyB/kzTpqH//0+SnaDHJbxx45pH8V2/I4 8gMJN8Jlb6HkrIvOCDk1oNI799nEwLpKMY6hCRamyBJdl50XljuHdN9f4ZhEBs6PVLeH GQGc7rFi78ar0gKp5WYYjzrbLfn1la2mL0VvlvN5rS5LKmDidy5Th1wHHoKNIk6Zimaw OFRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=lCRq/5YRMIPnSKdAvQ/xNtB9ljL4a/7uMo4ZKGjWMfM=; b=W2kLvp1koEOBZLgrfTOx8mba2Ud2TMZipHzbVGhTdkMXVLWTTAgH23dlpi8DGaimME e95NmcwudgEH9oAW7kZF6weTpZjWZygGKfciPOs4xC5wtgEJoOCJiB7zwoR8ky+Uh6Gg fD7NrdnHRLRRqVCMcUTpW47sJRojq7yTLIJQ8ILrba+aVkc4OH+w5F1zfjK5kKrw0WW0 x+guGjM4XogfnxsW6m9rdyOOV0WvxnCsBd3o3cuEeBDqq46BPUk9GFuya6rD3V2zjc2E qsqhgKRkPAwhLPpcK5MxvK78GNKjxDuveVMaDZpP7Vu0UOfBt14cHHYxgcdNvusILnG6 BDrw== X-Gm-Message-State: AEkoouuYDTF/UIL0ZUzvxt8H8BHu/DLOFdDRoswkhlm7Fjy0GxSOEjjpbZ3tLChdzfRLEQgRouKwloQbMwZAltNU X-Received: by 10.202.117.7 with SMTP id q7mr12700231oic.198.1470644406854; Mon, 08 Aug 2016 01:20:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.10.86 with HTTP; Mon, 8 Aug 2016 01:20:06 -0700 (PDT) In-Reply-To: References: From: =?UTF-8?Q?Mikael_St=C3=A5ldal?= Date: Mon, 8 Aug 2016 10:20:06 +0200 Message-ID: Subject: Re: Kafka appender expecting String but getting Byte? To: Log4J Users List Content-Type: multipart/alternative; boundary=001a1134fd1c76402005398b15ca archived-at: Mon, 08 Aug 2016 08:20:20 -0000 --001a1134fd1c76402005398b15ca Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Log4j always passes the LogEvent as a byte[] to Kafka, so using the Kafka StringSerializer will not work. You should not specify *key.serializer* or *value.serializer* in the Kafka appender config, they are automatically set to ByteArraySerializer by Log4j. I will improve the documentation on that. I think that *key.class.type* and *value.class.type *are Spring specific and thus not relevant here. On Fri, Aug 5, 2016 at 8:03 PM, Meadowlark Bradsher wrote: > Hello, > > I am attempting to use a kafka log appender. The topic is written to Kafk= a > 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.StringSe= rializer > 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). > > > > > > %msg%n"/> > > > > localhost:9092 > java.lang.String > java.lang.String > org.apache.kafka.common. > serialization.StringSerializer > org.apache.kafka.common. > serialization.StringSerializer > > > > > > > > > > > > > > > The test I am doing is > > > > private static final Logger logger =3D 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 > > > > > > > > --=20 [image: MagineTV] *Mikael St=C3=A5ldal* Senior software developer *Magine TV* mikael.staldal@magine.com Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. --001a1134fd1c76402005398b15ca--