Raghu Angadi wrote:
if ( debugEnabled ) {
  NameNode.stateChangeLog.debug( ...
}

Yes, this is sometimes warranted. I've also seen it abused, with, e.g., guards placed around all log statements. I suggest the following guidelines:

Guards should only be used:
 1. in inner-loop code where performance is known to be critical; and
2. for messages logged at a finer level than default (INFO), i.e., only for debug-level messages.

The case you mention seems to meet both of these criteria.  +1

Doug

Reply via email to