|
Relates :
|
Improve logging documentation w.r.t. the performance advices from Laurent Bourges:
Bad practices:
- string concat:
log.fine("message" + value); // means StringBuilder(message).append(String.valueOf(value)).toString(): 2 objects created and value.toString() called
- varags:
log.fine("message {0}", this); // create an Object[]
Best practices:
if (log.isLoggable(PlatformLogger.FINE) {
log.fine("message" + value);
}
if (log.isLoggable(PlatformLogger.FINE) {
log.fine("message {0}", this);
}