You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Matt Sicker (JIRA)" <ji...@apache.org> on 2016/01/12 23:14:39 UTC
[jira] [Assigned] (LOG4J2-1251) JUL bridge broken
[ https://issues.apache.org/jira/browse/LOG4J2-1251?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Sicker reassigned LOG4J2-1251:
-----------------------------------
Assignee: Matt Sicker
> JUL bridge broken
> -----------------
>
> Key: LOG4J2-1251
> URL: https://issues.apache.org/jira/browse/LOG4J2-1251
> Project: Log4j 2
> Issue Type: Bug
> Components: JUL adapter
> Reporter: Romain Manni-Bucau
> Assignee: Matt Sicker
> Attachments: LOG4J2-1251.patch, LOG4J2-1251___2.patch
>
>
> 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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org