Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
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:
logger.info("{foo}");
a SimpleMessage will be emitted but for
logger.log(recordWithSameContent);
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:
Logger.getLogger("foo").info("{test}"); Logger.getLogger("foo").log(new LogRecord(Level.INFO, "{test}"));
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())
Attachments
Attachments
Issue Links
- is duplicated by
-
LOG4J2-1298 NumberFormatException when using log4j-jul
- Resolved