开发者

Log4j, different appenders, same package and an individual class, write to different files?

I normally associate a package to an appender. But in this one case, this class is writing a lot of logs I want to filter out to a different appender. But the class is in the same package as my other classes.

I am trying to do this:

log4j.logger.com.app=DEBUG,MainAppender
log4j.logger.com.app.webservice.Web=DEBUG,WSAppender

I want the WSAppender to write to one file but I DON'T want the same logs from the MainAppender. Right now, the logs from W开发者_JAVA技巧SAppender also appear in MainAppender.


You need to set additivity=false on the child logger.

See example here.

log4j.additivity.com.app.webservice.Web = false
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜