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
https://github.com/google/guava/blob/master/guava/src/
com/google/common/base/Preconditions.java#L154
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.
_______________________________________________
logback-dev mailing list
logback-dev@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-dev

Reply via email to