log4j1日志继承说明: 略.
简短说明问题原因: "log4j.additivity"后边跟的包路径必须和另一项配置"log4j.logger"后边跟的包路径能对上, log4j不会分析你的项目的包结构.
例如:考虑取消com.game.gmActivation.logger包下的几个logger的继承关系, 只输出到指定路径的日志里, 错误的配置是只写一条父级包路径配置:
# 以下包路径的日志取消继承
log4j.additivity.com.game.gmActivation.logger=false
##行为日志定向配置
log4j.logger.com.game.gmActivation.logger.gameCurrency=INFO,gameCurrencyLog
log4j.logger.com.game.gmActivation.logger.onlineRoleNum=INFO,onlineRoleNumLog
log4j.logger.com.game.gmActivation.logger.itemBuy=INFO,itemBuyLog
log4j.logger.com.game.gmActivation.logger.zuanshiUse=INFO,zuanshiUseLog
log4j.logger.com.game.gmActivation.logger.gameSysActive=INFO,gameSysActiveLog
正确的配置为列举全部配置, 一一对应.
# 以下包路径的日志取消继承
log4j.additivity.com.game.gmActivation.logger.gameCurrency=false
log4j.additivity.com.game.gmActivation.logger.onlineRoleNum=false
log4j.additivity.com.game.gmActivation.logger.itemBuy=false
log4j.additivity.com.game.gmActivation.logger.zuanshiUse=false
log4j.additivity.com.game.gmActivation.logger.gameSysActive=false
##行为日志定向配置
log4j.logger.com.game.gmActivation.logger.gameCurrency=INFO,gameCurrencyLog
log4j.logger.com.game.gmActivation.logger.onlineRoleNum=INFO,onlineRoleNumLog
log4j.logger.com.game.gmActivation.logger.itemBuy=INFO,itemBuyLog
log4j.logger.com.game.gmActivation.logger.zuanshiUse=INFO,zuanshiUseLog
log4j.logger.com.game.gmActivation.logger.gameSysActive=INFO,gameSysActiveLog
欢迎留言指正.