Java 5 has introduced many features that can be make logging statements less cluttering, such as variable number of arguments and printf. That can alleviate all the message building code that happens when something is logged, as well as the surrounding if
.
For example, instead of writing:
if (log.isDebugEnabled()
{
log.debug("User id: "+uid+", Request id:"
+ rid +", Client IP: "+ip+" blah blah blah");
}
I would like to write:
log.debug("User id: %s, Request id: %s, Client IP: %s blah blah blah",
uid, rid, ip);
or something like that.
Do you know a logging framework or an extension to a logging framework that can help with that?