Menu

#5 Let 'if' conditions be optional with static log content.

open
5
2011-06-01
2011-06-01
No

Add an option that allows to set whether if conditions are optionally applied only to computed (non static) log messages.

Case A: Dynamic messages require a condition
if (log.isInfoEnabled())
log.info("Message " + variable)

Case B: Static messages do not require a condition
log.info("Static message")
log.info("Another static" + " message")
log.info("Static message with placeholder {}", variable)

Note: This option would primarily be applied to the inspection to avoid that case B is wrapped with a condition on a batch modification or is highlighted as being incorrect. Whether this behavior is applied must be configurable per level.

Discussion