[logback-dev] Logger arguments braces

Martin Grajcar maaartinus at gmail.com
Sat Aug 5 08:12:25 CEST 2017

I find the behavior of logger.whatever(format, ....) rather confusing.

1. What bothers me most: Forgetting a brace means that an argument gets
ignored, which may mean waiting one more week till something like

logger.error("Rare problem: {}, problem, details)

fires again. A simple fix would be to follow Guava's implementation like in
which says "Unmatched arguments will be appended to the formatted message
in square braces".

This is a simple fix and the behavior gets changed only in case of a user
error. I'd gladly contribute the fix.

2. A strange thing is that an exception needs no braces. So

logger.info("Foo {} bar {}", o1, o2)

leaves {} behind if o2 happens to be an exception. This is no big deal, but
it's undocumented. My logfiles are full of braces as it took me a while
till I found it out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-dev/attachments/20170805/1c63bf33/attachment.html>

More information about the logback-dev mailing list