[
https://issues.apache.org/jira/browse/LOG4J2-1418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15324300#comment-15324300
]
Remko Popma edited comment on LOG4J2-1418 at 6/10/16 11:12 AM:
---------------------------------------------------------------
I experimented a little and just changing the return type to MessageFactory2
results in a NoSuchMethodError when invoking this method on an implementation
that was compiled with the old interface.
However, changing the return type to the generic {{<MF extends MessagFactory>
MF getMessageFactory()}} did not throw an exception and worked even on an
implementation that was compiled with the old interface. So this is binary
compatible.
I like this better than having two separate methods getMessageFactory() and
getMessageFactory2(). The javadoc should be updated though to clearly state
that callers should expect a MessageFactory2 to be returned.
was (Author: [email protected]):
I experimented a little and just changing the return type to MessageFactory2
results in a NoSuchMethodError when invoking this method on an implementation
that was compiled with the old interface.
However, changing the return type to the generic {{<MF extends MessagFactory>
MF}} did not throw an exception and worked even on an implementation that was
compiled with the old interface. So this is binary compatible.
I like this better than having two separate methods getMessageFactory() and
getMessageFactory2(). The javadoc should be updated though to clearly state
that callers should expect a MessageFactory2 to be returned.
> 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, 2.6.1
> 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: [email protected]
For additional commands, e-mail: [email protected]