Romain Manni-Bucau created LOG4J2-1251:
------------------------------------------
Summary: JUL bridge broken
Key: LOG4J2-1251
URL: https://issues.apache.org/jira/browse/LOG4J2-1251
Project: Log4j 2
Issue Type: Bug
Reporter: Romain Manni-Bucau
org.apache.logging.log4j.jul.ApiLogger doesnt behave the same depending where
we come from (logger.info() vs logger.log() typically)
The main difference is the message factory used.
for this statement:
{code}
logger.info("{foo}");
{code}
a SimpleMessage will be emitted but for
{code}
logger.log(recordWithSameContent);
{code}
a MessageFormatMessage will be emitted making the log statement failling.
org.apache.logging.log4j.jul.ApiLogger#log(java.util.logging.LogRecord) should
be reworked to handle such a case.
Here how to reproduce it:
{code}
Logger.getLogger("foo").info("{test}");
Logger.getLogger("foo").log(new LogRecord(Level.INFO, "{test}"));
{code}
The fix is as simple as testing
org.apache.logging.log4j.jul.ApiLogger#log(java.util.logging.LogRecord) and if
null don't call logger.getMessageFactory().newMessage(record.getMessage(),
record.getParameters()) but
logger.getMessageFactory().newMessage(record.getMessage())
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]