You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2019/02/26 20:44:00 UTC

[jira] [Commented] (LOG4J2-2557) Improved printf() support.

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

Gary Gregory commented on LOG4J2-2557:
--------------------------------------

You can use % formatting in the standard API if you create your loggers with a StringFormattedMessage.

See [https://logging.apache.org/log4j/2.x/manual/messages.html]
{quote}StringFormattedMessage


StringFormattedMessage handles messages that use a conversion format that is compliant with java.lang.String.format(). While this Message has more flexibility than ParameterizedMessage, it is also 5 to 10 times slower.
{quote}
See 

> Improved printf() support.
> --------------------------
>
>                 Key: LOG4J2-2557
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2557
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.11.1
>            Reporter: Robert F
>            Priority: Major
>              Labels: debug, error, fatal, info, log, printf, trace, warn
>
> I was excited to see log4j2 supports "printf-style messages"; however, I was disappointed to learn it was not supported by the standard logging methods.
> The standard log methods do support the "{}" formatting, but not "%" formatting.  The "printf()" method is cumbersome and a longer syntax.
> Thus, I would like to see one of the following two improvements:
> 1) Have the standard log methods support both "{}" and "%" formatting.
> 2) Add methods for tracef(), debugf(), infof(), warnf(), errorf(), fatalf().
> Respectfully submitted, -RF
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)