logger.debug("Saved order successfully. Order ID : " + order.getId() +
" items in order " + order.getItems().size());In the above case there is a new string object created by concatenating all the parameters before making the call to debug method. This is done regardless of debug is enabled or not which will be a unnecessary performance overhead if debug is disabled.
if( logger.isDebugEnabled()){
logger.debug("Before saving the order");
}In the above code section the if condition is not necessary as there is no String concatenations involved and ends up adding two redundant lines of code.
Therefore the rule would be to do a isDebugEnabled check only if there is any String concatenation involved in the call to debug. This seems to be obvious but developers somehow keep getting this wrong.