logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: GC lean way to convert StringBuilder to byte[]
Date Tue, 23 Feb 2016 16:23:56 GMT
I see we now have:

org.apache.logging.log4j.core.layout.AbstractStringLayout.Serializer2

Should we
deprecate org.apache.logging.log4j.core.layout.AbstractStringLayout.Serializer
and reimplement everything in terms of Serializer2, even if objects are
allocated?

Gary

On Tue, Feb 23, 2016 at 7:59 AM, Remko Popma <remko.popma@gmail.com> 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 converting
> 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() methos
> on the layout (other managers still call Layout#toByteArray).
>
>
>
> On Wed, Feb 24, 2016 at 12:47 AM, Mikael Ståldal <
> 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
>>> 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åldal <mikael.staldal@magine.com>
>>> 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åldal*
>>> 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åldal*
>> 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
<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
View raw message