Closed rastislavpapp closed 1 year ago
Thanks for report - I'll check soon.
Just a question - how did you obtain the log
instance? what's the class of this instance?
log instance is obtained via
this.log = org.slf4j.LoggerFactory.getLogger(loggerName);
and it is an instance of org.ops4j.pax.logging.slf4j.Slf4jLogger
as I've investigated a little further, in the Slf4jLogger
the message gets formatted correctly, via these calls:
FormattingTuple tuple = MessageFormatter.arrayFormat(format, argArray);
m_delegate.debug(m, tuple.getMessage(), tuple.getThrowable());
after this, tuple.getMessage()
returns "ABC test{}test DEF", but then it is formatted again in PaxLoggerImpl
:
FormattingTriple ft = FormattingTriple.discover(format, false, arg);
doLog(marker.log4j2Marker(), Level.DEBUG, m_fqcn, ft.getMessage(), ft.getThrowable(), ft.getServiceReference(), ft.getArgArray());
After this, ft.getMessage() returns "ABC testnulltest DEF", I guess it took the {} as a place to put an exception (which is not present as a last argument, so it is null)
@rastislavpapp I've fixed this issue in 2.2.x branch - thank you very much for spotting, because it wass quite serious bug.
If you need a release, just let me know ;)
cc: @jbonofre
environment - karaf 4.4.3, pax logging 2.2.0, using slf4j api and log4j2 implementation
problem:
outputs: