Josh is the code reviewer on a fairly-large, Java-based message routing system. At one of his reviews, a coworker submitted some code that logged events like this:

logDebug("Account Number is '" + accNum + "', Transaction ID is '" + tranId + ""');

It's fairly standard Java code, but "wastes" a handful of clock cycles to concatenate strings that won't be logged in production. Since perforce is critical in the application, Josh requested that she check if debug logging is enabled first before logging the message. She agreed, and returned the next day with each and every logDebug() statement with the following pattern ...

if (isDebugEnabled())
{
  logDebug("Account Number is '" + accNum + "', Transaction ID is '" + tranId + ""');
} else {
  logInfo("The current log level is not debug. The message will not be logged.");
}