如何在log4j中启用程序包级别的日志记录 [英] how to enable package level logging in log4j

查看:54
本文介绍了如何在log4j中启用程序包级别的日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我,log4j中的包级别日志记录是什么? 以及如何启用它,今天我的面试问题无法回答这个问题:-(

Can any one tell me, what is package level logging in log4j ? And how to enable this, today my interview question am unable to answer this :-(

即使我没有在Google中找到好的解决方案.

Even i didn't find good solution in Google.

非常感谢您.

推荐答案

包级别日志记录是log4j的标准日志记录.通过log4j配置,您可以指定软件包和相关级别.

Package level logging is the standard logging of log4j. With log4j configuration, you'd specify the package and the associated level.

简介示例中,有".com"的程序包级日志记录. foo".

In the intro example, there is package level logging for "com.foo".

# Print only messages of level WARN or above in the package com.foo.
log4j.logger.com.foo=WARN

这篇关于如何在log4j中启用程序包级别的日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆