Return-Path: X-Original-To: apmail-logging-log4j-dev-archive@www.apache.org Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7ED6818971 for ; Wed, 24 Feb 2016 22:46:36 +0000 (UTC) Received: (qmail 94614 invoked by uid 500); 24 Feb 2016 22:46:36 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 94565 invoked by uid 500); 24 Feb 2016 22:46:36 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 94555 invoked by uid 99); 24 Feb 2016 22:46:36 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2016 22:46:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id C2219C04EC for ; Wed, 24 Feb 2016 22:46:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=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: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id LZeTFjHOeyXR for ; Wed, 24 Feb 2016 22:46:33 +0000 (UTC) Received: from mail-ob0-f181.google.com (mail-ob0-f181.google.com [209.85.214.181]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 768905FAC9 for ; Wed, 24 Feb 2016 22:46:33 +0000 (UTC) Received: by mail-ob0-f181.google.com with SMTP id jq7so32351746obb.0 for ; Wed, 24 Feb 2016 14:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=N8We11xQHX4mZoNyYbw5g9uGXX0BhH6LntrS0tA/gLM=; b=gRxrrq9PrU9GoNbV7uWu7vKm6tBBb9tEg5rMveSAk+1N5tTSsJN7Pd3uPykF+nhIQl mT1G+ArGicOUA9THx+NJuXllvsf8eb3o/F21eCseCUl24X188YbK4Yhj+EffkoMiSk1T sxGUhb3dsudtzTBVNAJ29gS4MD6HfW32j7Hl38yOF/pMRb1VqonzmpbDiL4o5mv4LiZ9 rI9MTmP3+tvdo8zcWgpVHu+jSKc2ppMweoRJs9/jlQ9rJUerizRW+18BLDD1cvjAXsBs rchs2PcGoag+f3AIzpf+DGDuH+IA2EQ7En5mSURLnao3Zol6LThUMYYTyUQYdZDcZAv6 ukXg== 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:date :message-id:subject:from:to:content-type; bh=N8We11xQHX4mZoNyYbw5g9uGXX0BhH6LntrS0tA/gLM=; b=aKY7hBe9GG9b4b2QxBvXAU/Rf2CG9uNQA8LVqNzE6vyYMaIpCobZqymgoXpIUZBXvD u1HMcvMcloSGmmEXckrwnFY9qvCyvhdORl78j0G6+FmMYRo6VUI/W5kHhqHdgnzPUDL+ wjMjgqA0DjNd5MedUVRVgukPDSMgLktm+MbaYMhmZQ7vTf+za+aa8Q8FWyVw71yM1w8c FUkqU72Ws0z+hTJTD1oYYbxqpza434wiL+HViaA4gQyrIuS4pPIR6r5/Zg1JoCArL/PF nxl+A1/V19iIUlQV3zvkhD82MRgO0jfPC/3VOIXww326Mc6we3+4Syo70FslBp09YrP3 +ZNQ== X-Gm-Message-State: AG10YOTMekSKsZigTZ4d2OlBMwTNNz7SxqvyqhvWU5CXunIf1bqtcJaipwM0RhShYh092dXnufPPS7loR31/mQ== MIME-Version: 1.0 X-Received: by 10.182.111.137 with SMTP id ii9mr34386944obb.77.1456353987047; Wed, 24 Feb 2016 14:46:27 -0800 (PST) Received: by 10.157.46.34 with HTTP; Wed, 24 Feb 2016 14:46:26 -0800 (PST) In-Reply-To: References: <2C8AF449-DE02-4BF1-A583-537B3AE5FFE4@gmail.com> Date: Wed, 24 Feb 2016 14:46:26 -0800 Message-ID: Subject: Re: GC lean way to convert StringBuilder to byte[] From: Gary Gregory To: Log4J Developers List Content-Type: multipart/alternative; boundary=089e015374d810b9cf052c8bd61c --089e015374d810b9cf052c8bd61c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Feb 23, 2016 at 8:23 AM, Gary Gregory wrote: > I see we now have: > > org.apache.logging.log4j.core.layout.AbstractStringLayout.Serializer2 > > Should we > deprecate org.apache.logging.log4j.core.layout.AbstractStringLayout.Seria= lizer > and reimplement everything in terms of Serializer2, even if objects are > allocated? > Thoughts on this? Gary > > Gary > > On Tue, Feb 23, 2016 at 7:59 AM, Remko Popma > wrote: > >> Layout now extends Encoder so now it has this method: >> >> encode(LogEvent source, ByteBufferDestination destination) >> >> PatternLayout implements this method. It delegates the work of convertin= g >> the StringBuilder to bytes and writing these bytes into the >> ByteBufferDestination to the TextEncoderHelper class. No objects are >> created during this conversion. >> >> The final piece is (Rolling)RandomAccessFileAppender, whose manager >> implements ByteBufferDestination. This appender calls the #encode() meth= os >> on the layout (other managers still call Layout#toByteArray). >> >> >> >> On Wed, Feb 24, 2016 at 12:47 AM, Mikael St=C3=A5ldal < >> mikael.staldal@magine.com> wrote: >> >>> I cannot really find it. >>> >>> On Tue, Feb 23, 2016 at 3:59 PM, Remko Popma >>> wrote: >>> >>>> Yes, that was implemented in >>>> https://issues.apache.org/jira/browse/LOG4J2-1274. >>>> >>>> Please also see the description and discussion in the epic >>>> https://issues.apache.org/jira/browse/LOG4J2-1270. >>>> >>>> Sent from my iPhone >>>> >>>> On 2016/02/23, at 23:56, Mikael St=C3=A5ldal >>>> wrote: >>>> >>>> Do we have any way to convert a StringBuilder to a byte[], without any >>>> intermediate String? >>>> >>>> It seems like org.apache.logging.log4j.core.util.StringEncoder cannot >>>> do it. >>>> >>>> -- >>>> [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. >>>> >>>> >>> >>> >>> -- >>> [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. >>> >> >> > > > -- > E-Mail: garydgregory@gmail.com | ggregory@apache.org > Java Persistence with Hibernate, Second Edition > > JUnit in Action, Second Edition > Spring Batch in Action > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > --=20 E-Mail: garydgregory@gmail.com | ggregory@apache.org Java Persistence with Hibernate, Second Edition JUnit in Action, Second Edition Spring Batch in Action Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory --089e015374d810b9cf052c8bd61c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On T= ue, Feb 23, 2016 at 8:23 AM, Gary Gregory <garydgregory@gmail.com= > wrote:
I see= we now have:

org.apache.logging.log4j.core.layout.Abstr= actStringLayout.Serializer2

Should we deprecat= e=C2=A0org.apache.logging.log4j.core.layout.AbstractStringLayout.Serializer= and reimplement everything in terms of Serializer2, even if objects are al= located?

Thoughts on this?

Gary
=C2=A0

Gary

On Tue, Feb = 23, 2016 at 7:59 AM, Remko Popma <remko.popma@gmail.com>= wrote:
Layout now exten= ds Encoder so now it has this method:
encode(LogEvent source, ByteBufferDestination destination)
PatternLayout implements this method. It delegates the work = of converting the StringBuilder to bytes and writing these bytes into the B= yteBufferDestination to the TextEncoderHelper class. No objects are created= during this conversion.

The final piece is (Rolli= ng)RandomAccessFileAppender, whose manager implements ByteBufferDestination= . This appender calls the #encode() methos on the layout (other managers st= ill call Layout#toByteArray).



On Wed, Feb= 24, 2016 at 12:47 AM, Mikael St=C3=A5ldal <mikael.staldal@magine.= com> wrote:
I cannot really find it.

On Tue, Feb 23, 2016 at 3:59 PM, Remko Popma <remko.popma@gmail.com> wrote:
Yes, that was implemented in=C2=A0https://i= ssues.apache.org/jira/browse/LOG4J2-1274.=C2=A0

Please also see the description and discussion in the epic=C2=A0ht= tps://issues.apache.org/jira/browse/LOG4J2-1270.=C2=A0

Sent= from my iPhone

On 2016/02/23, at 23:56, Mika= el St=C3=A5ldal <mikael.staldal@magine.com> wrote:

Do we have any way to convert a StringBu= ilder to a byte[], without any intermediate String?

It s= eems like=C2=A0org.apache.logging.log4j.core.util.StringEncoder=C2=A0cannot do it.

--
3D"MagineTV"

Mikael St=C3=A5ldal
Senior software developer

Magine TV
mikael.s= taldal@magine.com=C2=A0 =C2=A0=C2=A0
Grev Turegatan 3 =C2=A0|=C2=A0114 46 St= ockholm, Sweden=C2=A0 | =C2=A0 www.magine.com

Privilege= d and/or Confidential Information may be contained in this message. If=20 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,=C2=A0
you should destroy this message and kindly notify the sender by reply ema= il. =C2=A0=C2=A0



--
3D"MagineTV"

Mikael St=C3=A5ldal
Senior software developer

Magine TV
mikael.s= taldal@magine.com=C2=A0 =C2=A0=C2=A0
Grev Turegatan 3 =C2=A0|=C2=A0114 46 St= ockholm, Sweden=C2=A0 | =C2=A0 www.magine.com

Privilege= d and/or Confidential Information may be contained in this message. If=20 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,=C2=A0
you should destroy this message and kindly notify the sender by reply ema= il. =C2=A0=C2=A0




<= /div>--



--
--089e015374d810b9cf052c8bd61c--