On Thu, Aug 9, 2012 at 4:32 PM, Ralph Goers <[email protected]> wrote:
> This topic has come up several times, although your request seems slightly 
> different.
>
> Every log event in Log4j 2 is handled by a message object.  When you specify 
> logger.debug("", p1, p2) that gets converted essentially to logger.debug(new 
> ParameterizedMessage("", p1, p2)); .  So if you want to use a different 
> message format you could create a JavaStringMessage and just do 
> logger.debug(new JavaStringMessage("", p2, p2));
>
> Most proposals to date have asked to use String.format for the whole String 
> while you seem to be suggesting that each item within {} be replaced by 
> whatever String.format returns from the single parameter passed to it.  I 
> would think that would be slower than handling the whole String.
>
> Ceki has tested java.text.MessageFormat and said that it is at least 10 times 
> slower than the way ParameterizedMessage work.  I don't know if he, or anyone 
> else, has compared Formatter or String.format against ParameterizedMessage 
> but I'd find it hard to believe it isn't considerably slower also.  That 
> said, if someone wants to implement it I have no problem adding it.  If it is 
> demonstrated to be nearly the same speed I would also have no problem making 
> it the default.
>
> Ralph

Good points. Message formatting speed isn't too much of my concern
since most of my logging is solely for DEBUG/TRACE level. I will
investigate if there's a happy medium and get back to you.

Paul

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

Reply via email to