[ 
https://issues.apache.org/jira/browse/LOG4J2-1824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15885154#comment-15885154
 ] 

Matt Sicker commented on LOG4J2-1824:
-------------------------------------

Based on some mailing list discussions, it may be possible that the 
{{ByteBufferDestination.drain(ByteBuffer)}} method could be used here. 
Honestly, to properly implement this may require some interesting changes to 
kafka-clients (e.g., a ByteBufferDestination-like interface for writing 
directly to a message while it's being prepared to be sent over the network so 
we can buffer a log message without splitting it into multiple kafka messages). 
This is definitely going to require more research to handle properly.

It may be possible that GatheringByteChannel may be useful here.

> (GC) Avoid allocating temporary objects in KafkaAppender
> --------------------------------------------------------
>
>                 Key: LOG4J2-1824
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1824
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Appenders
>            Reporter: Matt Sicker
>
> Due to API limitations in kafka-clients, log messages must be encoded into 
> byte arrays rather than directly into ByteBuffers via 
> {{Encoder<LogEvent>}}-enhanced layouts. I've opened up KAFKA-4802 to get 
> support on the client side for not converting the provided ByteBuffers back 
> into a byte array, but in the meantime, KafkaAppender and KafkaManager can be 
> enhanced to use the Encoder API.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to