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>
< root > < level value = "DEBUG" /> < appender-ref ref = "console" /> </ root > </ log4j:configuration >
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.
Log4j allows logged messages to contain format strings that reference external information through the Java Naming and Directory Interface (JNDI). This allows information to be remotely retrieved across a variety of protocols, including the Lightweight Directory Access Protocol (LDAP).
The output from Log4j can go to the console, but it can also go to an email server, a databaseW table, a log file, or various other destinations. Another great benefit of Log4j is that different levels of logging can be set. The levels are hierarchical and are as follows: TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With