You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2014/08/11 18:16:12 UTC

[jira] [Commented] (LOG4J2-772) Performance enhancement: ParameterizedMessage should not take String snapshots of its parameters in constructor

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

Ralph Goers commented on LOG4J2-772:
------------------------------------

Notice that the Object array and the formatted message member variables are transient while the string array and message pattern are not.  This means that after the ParameterizedMessage is serialized it can only be formatted from the string array. Of course, this means the string array must be populated before the Message is serialized.

> Performance enhancement: ParameterizedMessage should not take String snapshots of its parameters in constructor
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-772
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-772
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: 2.0, 2.0.1
>            Reporter: Remko Popma
>              Labels: Performance
>
> Discovered during investigation for LOG4J2-763, {{ParameterizedMessage}} currently initializes its {{String[] stringArgs}} field in the constructor. This may be wasted work if the message is not used, for example because the log level is below the filter threshold.
> The {{stringArgs}} field should be initialized in the {{getFormattedString}} method, not earlier.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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