One of the distinctive features of log4j is the notion of inheritance in loggers. Using a logger hierarchy it is possible to control which log statements are output at arbitrarily fine granularity but also great ease. This helps reduce the volume of logged output and minimize the cost of logging.
log4j一个出彩的特点是引入loggers继承的概念,使用logger继承可以更好控制日志输出的粒度,更加易用。有效的减少了日志输出的数量并且使记录日志减至最小的代价。
On an AMD Duron clocked at 800Mhz running JDK 1.3.1, it costs about 5 nanoseconds to determine if a logging statement should be logged or not. Actual logging is also quite fast, ranging from 21 microseconds using the SimpleLayout, 37 microseconds using the TTCCLayout. The performance of the PatternLayout is almost as good as the dedicated layouts, except that it is much more flexible.
在AMD主频为800MHz的毒龙处理器运行JDK1.3.1 ,log4j花费约5纳秒来确定是否应该记录日志。实际日志记录也十分迅速,使用SimpleLayout(日志布局)需要21微秒 , 使用TTCCLayout(日志布局)需要37微秒 。PatternLayout(日志布局)的表现非常专业,但它是灵活得多。