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

Remko Popma updated LOG4J2-1719:
--------------------------------
    Description: 
When logging asynchronously, {{Message::getFormattedMessage}} is called to give 
Message implementations a chance to take a snapshot of mutable objects before 
the message is passed to another thread. (See LOG4J2-763, LOG4J2-1718. 
Exceptions are Messages implementing ReusableMessage or 
AsynchronouslyFormattable.)

Some Messages implement StringBuilderFormattable to avoid creating temporary 
objects in the Layout.

The StringBuilderFormattable::formatTo(StringBuilder) method should be 
implemented such that it first checks if a cached formatted message string 
exists. If so, this string should be appended to the StringBuilder. If no 
cached message string exists logging is done synchronously and the formatted 
message can safely be created afresh.

This bug exists in:
* ObjectMessage
* SimpleMessage


  was:
When logging asynchronously, {{Message::getFormattedMessage}} is called to give 
Message implementations a chance to take a snapshot of mutable objects before 
the message is passed to another thread. (See LOG4J2-763, LOG4J2-1718. 
Exceptions are Messages implementing ReusableMessage or 
AsynchronouslyFormattable.)

Some Messages implement StringBuilderFormattable to avoid creating temporary 
objects in the Layout.

The StringBuilderFormattable::formatTo(StringBuilder) method should be 
implemented such that it first checks if a cached formatted message string 
exists. If so, this string should be appended to the StringBuilder. If no 
cached message string exists logging is done synchronously and the formatted 
message can safely be created afresh.

This bug exists in:
* ObjectMessage
* SimpleMessage
* ThreadDumpMessage



> StringBuilderFormattable Messages should used cached formatted message if it 
> exists
> -----------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1719
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1719
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 2.7
>            Reporter: Remko Popma
>            Assignee: Remko Popma
>             Fix For: 2.8
>
>
> When logging asynchronously, {{Message::getFormattedMessage}} is called to 
> give Message implementations a chance to take a snapshot of mutable objects 
> before the message is passed to another thread. (See LOG4J2-763, LOG4J2-1718. 
> Exceptions are Messages implementing ReusableMessage or 
> AsynchronouslyFormattable.)
> Some Messages implement StringBuilderFormattable to avoid creating temporary 
> objects in the Layout.
> The StringBuilderFormattable::formatTo(StringBuilder) method should be 
> implemented such that it first checks if a cached formatted message string 
> exists. If so, this string should be appended to the StringBuilder. If no 
> cached message string exists logging is done synchronously and the formatted 
> message can safely be created afresh.
> This bug exists in:
> * ObjectMessage
> * SimpleMessage



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

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