A potential alternative to setting the additivity property is to check your registrars from the most specific to the most general. In the following example, we expect to see dual logging in the Console for any log events that occur in foo.bar.LoggingExampleClass. It would be safe to remove the additional console appender from foo.bar.LoggingExampleClass Logger, as it is already covered by the root logger.
<Logger name="foo.bar.LoggingExampleClass" level="DEBUG"> <AppenderRef ref="Console" /> <AppenderRef ref="FooBarPackageLogging" /> </Logger> <Root level="WARN"> <AppenderRef ref="Console" /> <AppenderRef ref="MainLogFile" /> </Root>
There are trade-offs with both the additivity adjustment approach and the application adjustment approach. Disabling additivity may inadvertently stop the use of the desired added level logger. In the above example, setting the additivity="false" property in the foo.bar.LoggingExampleClass Logger file means that the logging event will not be added to the MainLogFile specified in the root log.
On the other hand, relying on parent applications can be problematic if parent consoles are changed without exploring the effects for more granular registrars. For example, suppose that there is a requirement that foo.bar.LoggingExampleClass events are written to the Console. They are currently in the above configuration configuration because of additivity, even if the application foo.bar.LoggingExampleClass Logger Console is uninstalled. However, if the console application was also removed from the root registrar without any additional settings, this requirement will no longer be met.
GoldDragonTSU Sep 29 '17 at 18:38 2017-09-29 18:38
source share