简体   繁体   English

使log4j可加性等于true或false的结果是什么?

[英]What is the result of making log4j additivity equals to true or false?

In simple terms what is the result of making additivity="true" or additivity="false" when adding a Log4j configuration for a specific class like this? 简单来说,当为这样的特定类添加Log4j配置时, additivity="true"additivity="false"的结果是什么?

<Logger name="com.mypage.glass.TryWindow" level="INFO" additivity="true">
  <AppenderRef ref="console"/>
  <AppenderRef ref="file"/>
</Logger>

By default, a logger inherits the appenders from its ancestors. 默认情况下,记录器从其祖先继承appender。 By setting additivity="false" , you prevent this behaviour. 通过设置additivity="false" ,可以防止此行为。

In your example, there may be appenders associated with com.mypage.glass or com.mypage or even the root logger that would be inherited if you don't set that property to false . 在您的示例中,可能存在与com.mypage.glasscom.mypage相关联的appender,甚至可能是在未将该属性设置为false将继承的根记录器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM