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

Gary Gregory edited comment on LOG4J2-1418 at 6/9/16 12:17 AM:
---------------------------------------------------------------

We are not GC-free, I claim, even in the scenarios we claim we are: Look at 
{{org.apache.logging.log4j.core.appender.AbstractManager.getContentFormat()}}:

{code:java}
    protected void log(final Level level, final String message, final Throwable 
throwable) {
        final Message m = LOGGER.getMessageFactory().newMessage("{} {} {}: {}",
                getClass().getSimpleName(), getName(), message, throwable);
        LOGGER.log(level, m, throwable);
    }
{code}

This calls the {{Object...}} method and not the unrolled version.

We MUST change all callers of {{getMessageFactory()}} to a new 
{{getMessageFactory2()}} for unrolled args APIs to kick in.

I have a patch in progress... but I can already tell that it is a PITA and that 
we should seriously consider *merging* {{MessageFactory2}} up into 
{{MessageFactory}}.

...



was (Author: garydgregory):
We are not GC-free, I claim, even in the scenarios we claim we are: Look at 
{{org.apache.logging.log4j.core.appender.AbstractManager.getContentFormat()}}:

{code:java}
    protected void log(final Level level, final String message, final Throwable 
throwable) {
        final Message m = LOGGER.getMessageFactory().newMessage("{} {} {}: {}",
                getClass().getSimpleName(), getName(), message, throwable);
        LOGGER.log(level, m, throwable);
    }
{code}

This calls the {{Object...}} method and not the unrolled version.

We MUST change all callers of {{getMessageFactory()}} to a new 
{{getMessageFactory2()}} for unrolled args APIs to kick in.

I have a patch in progress...


> Provide MessageFactory2 to custom Logger implementations
> --------------------------------------------------------
>
>                 Key: LOG4J2-1418
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1418
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: 2.6
>            Reporter: Mikael Ståldal
>
> It would be useful for a custom Logger implementation to be able to get hold 
> of a {{MessageFactory2}} (and not just a {{MessageFactory}}), in order to 
> efficiently process {{CharSequence}} etc.
> {{Logger.getMessageFactory()}} return {{MessageFactory}}, even though the 
> sole implementation in {{AbstractLogger}} do have a {{MessageFactory2}} 
> available.



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