开发者

Log4j: xml configuration: category tag

I am learning log4j. I have seen the <category> tag in the xml configuration file but could find nothing information about it's subelements(children) and attributes.

Could anyone, please, tell me, how to use this tag and what do it'开发者_开发百科s parameters do? Maybe there are some usefull link?


The answer is:

One of the common requirement in Java projects, that are using Log4j logging, is to have different log files for each module (or layer) in the project. For example, if you have a web application, you may want to log the debug/info messages from the service layer to a service.log file and the log messages from the presentation layer to the web-app.log file and so on. This is very simple to achieve in Log4j. Log4j has a concept called Category using which you can classify a package as a category and assign a appender to that category alone.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜