What is the result of making log4j additivity equals to true or false?
JavaLoggingLog4jJava Problem Overview
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?
<Logger name="com.mypage.glass.TryWindow" level="INFO" additivity="true">
<AppenderRef ref="console"/>
<AppenderRef ref="file"/>
</Logger>
Java Solutions
Solution 1 - Java
By default, a logger inherits the appenders from its ancestors. By setting additivity="false"
, you prevent this behaviour.
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
.