在log4net的记录器和根级别之间的区别? [英] Difference between logger and root level in log4Net?

查看:329
本文介绍了在log4net的记录器和根级别之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对面的两节排在log4net的configiurations:

I just came across the two sections in log4net configiurations:

<logger name="File">
  <level value="All" />
</logger>
<root>
  <level value="INFO" />
</root>

我想知道什么是在记录器和标签根指定等级的区别?它们之间的区别是什么?

May I know what is the difference of specifying levels at logger and root tags? What is the difference between them?

推荐答案

表示应用程序中所有日志和记录允许指某种日志。使用它们只能对某类日志更改日志配置。有评论看你的样品:

root means all logs in the application, and logger allows to refer to a certain kind of log. Using them you can change the log configuration only for cetain logs. Look your sample with comments:

<!-- Set root logger level to INFO-->
<root>
    <level value="INFO" />
</root>

<!-- Print only messages of level WARN or above in the package "File" -->
<logger name="File">
    <level value="WARN" />
</logger>

在此示例中所有日志都是INFO,和类型文件(或已命名文件)的日志WARN。

In this sample all logs are to INFO, and the the log of the type "File" (or named File) is WARN.

这篇关于在log4net的记录器和根级别之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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