[
https://issues.apache.org/jira/browse/LOG4J2-1329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Remko Popma updated LOG4J2-1329:
--------------------------------
Description:
I propose that we change {{Message.getFormattedMessage()}} to return a
{{CharSequence}} instead of a String.
I believe this change would be backwards compatible (all Message
implementations that return a String will work as is), and it opens the way
for zero-GC Message implementations to return a cached StringBuilder as Mikael
[suggested on the log4j-dev mailing
list|http://mail-archives.apache.org/mod_mbox/logging-log4j-dev/201603.mbox/%3CCAAFrFhSs4EqjOERwHObKAZP4wjGWeiCET1nyE1FVndYdePk2yw%40mail.gmail.com%3E].
was:
I propose that we change {{Message.getFormattedMessage()}} to return a
{{CharSequence}} instead of a String.
I believe this change would be backwards compatible (all Message
implementations that return a String will work as is), and it opens the way
for zero-GC Message implementations to return a cached StringBuilder as Mikael
[suggested on the log4j-dev mailing
list|http://mail-archives.apache.org/mod_mbox/logging-log4j-dev/201603.mbox/%3CCAAFrFhSs4EqjOERwHObKAZP4wjGWeiCET1nyE1FVndYdePk2yw%40mail.gmail.com%3E].
It could potentially make life a little harder for the Appenders and Layouts
consuming the event. However, they usually just append the return value to a
StringBuilder when building a text representation of the log event.
I can't see any drawbacks to doing this, but since this is an API change, can I
get more feedback if it's okay to move ahead with this?
> API change: let Message.getFormattedMessage() return CharSequence instead of
> String
> -----------------------------------------------------------------------------------
>
> Key: LOG4J2-1329
> URL: https://issues.apache.org/jira/browse/LOG4J2-1329
> Project: Log4j 2
> Issue Type: Improvement
> Components: API
> Affects Versions: 2.5
> Reporter: Remko Popma
>
> I propose that we change {{Message.getFormattedMessage()}} to return a
> {{CharSequence}} instead of a String.
> I believe this change would be backwards compatible (all Message
> implementations that return a String will work as is), and it opens the way
> for zero-GC Message implementations to return a cached StringBuilder as
> Mikael [suggested on the log4j-dev mailing
> list|http://mail-archives.apache.org/mod_mbox/logging-log4j-dev/201603.mbox/%3CCAAFrFhSs4EqjOERwHObKAZP4wjGWeiCET1nyE1FVndYdePk2yw%40mail.gmail.com%3E].
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]