首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

log4j additivity的施用技巧

2012-12-24 
log4j additivity的使用技巧log4j的additivity属性值默认是设置为true的。可参考其api,地址:http://logging

log4j additivity的使用技巧

log4j的additivity属性值默认是设置为true的。可参考其api,地址:http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Category.html#setAdditivityboolean。

?

描述:Additivity is set to true by default, that is children inherit the appenders of their ancestors by default. If this variable is set to false then the appenders found in the ancestors of this category are not used. However, the children of this category will inherit its appenders, unless the children have their additivity flag set to false too. See the user manual for more details.

?

默认为true时,就会产生冗余日志。所以只要设置为false,就可以去除冗余了。

?

log4j.rootLogger = INFO, talog4j.logger.com.test = INFO, talog4j.additivity.com.test = false

?

另外一篇参考文章的地址:http://veerasundar.com/blog/2009/08/log4j-tutorial-additivity-what-and-why/

热点排行