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

Remko Popma commented on LOG4J2-1326:
-------------------------------------

Yes, we agreed to not make API changes that break binary backwards 
compatibility until a next major release (log4j-3.0). 

But perhaps I am overcomplicating things. Anywhere that the current API takes 
an Object, we can check if it implements CharSequence and avoid calling 
toString() on it if it does. This can be achieved without API changes.  

Let me rephrase my question: do you require methods like:

{code}
debug(CharSequence, Object... params)
debug(CharSequence)
{code}

Or are the existing methods like the below sufficient given that all Object 
parameters will be treated as CharSequences where possible. 

{code}
debug(String, Object... params)
debug(Object)
...
{code}

There is also another ticket LOG4J2-1278 to unroll the varargs, so if you do 
need the method where the message pattern is a CharSequence instead of a 
String, would we then also need the unrolled variants like the below?

{code}
debug(CharSequence, Object p0)
debug(CharSequence, Object p0, Object p1)
debug(CharSequence, Object p0, Object p1, Object p2)
...
{code}

> Provide support for CharSequence parameters for low and zero-GC applications
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-1326
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1326
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: API
>    Affects Versions: 2.5
>            Reporter: Vlad Shurupov
>              Labels: features, performance
>
> Currently, the preferred way of logging character sequences in log4j 2 is by 
> passing in tokens of type {{java.lang.String}}. It would be very beneficial 
> if the API could provide methods that take {{java.lang.CharSequence}} tokens. 
> This would allow high performance zero or low-GC applications to re-use the 
> existing mutable structures implementing {{java.lang.CharSequence}}  for 
> continuous logging without new objects being created.
> A high-performance implementation of the logger would be expected to copy out 
> the contents of a single or multiple instances of {{java.lang.CharSequence}} 
> so that they could be re-used in the subsequent logging call.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to