[ 
https://issues.apache.org/jira/browse/LOG4J2-1412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Remko Popma resolved LOG4J2-1412.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.6.2

I increased the size of the pool of reusable StringBuilders in Unbox from 16 to 
32 and made the size configurable. Also added tests and javadoc documentation.

The above is committed to master.

Marking this issue as Resolved and opened  LOG4J2-1417 to track the ThreadLocal 
issue separately.

> Unbox ringbuffer size should be configurable
> --------------------------------------------
>
>                 Key: LOG4J2-1412
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1412
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: 2.6, 2.6.1
>            Reporter: Remko Popma
>            Assignee: Remko Popma
>             Fix For: 2.6.2
>
>
> The Unbox utility is meant to be used for primitive parameters to a logging 
> call with a parameterized message, for example {{logger.debug("pi is {}", 
> Unbox.box(Double.PI))}}.
> Unbox is implemented with a ThreadLocal a ringbuffer of StringBuilders. By 
> default, the ringbuffer has 16 slots. After 16 calls to {{Unbox.box()}} it 
> reuses the first StringBuilder again, so there is a limit to how many things 
> can be boxed before the call to Message.getFormattedMessage() breaks.
> This needs to be better documented in the Unbox javadoc and the garbage-free 
> manual page. Furthermore, there should be a mechanism to allow users to 
> increase the size of the ringbuffer.
> Finally, if Constants.ENABLE_THREADLOCALS is false we should not store 
> non-JDK classes in ThreadLocals. The Unbox.State class breaks that principle.



--
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