书写log4j输出日志时,使用 if (logger.isInfoEnabled()) logger.info(...); 会很大程度减少性能开销。如调用isInfoEnabled耗时10纳秒,不调用耗时350纳秒。