Question

In log4j2 is it legal to have multiple loggers with the same name? If it isn't, how would I be able to accomplish the same thing?

<logger name="com.foo.bar" level="error" additivity="false">
    <appender-ref ref="SMTPAppender" /> 
    <appender-ref ref="stdout" />
</logger>
<logger name="com.foo.bar" level="INFO">
    <appender-ref ref="RollingFile"/>
</logger>
<root level="INFO">
    <appender-ref ref="stdout"/>
</root>
Was it helpful?

Solution

This question has already been resolved here: How to configure log4j to log different log levels to different files for the same logger

You must use an appender, as you cannot have two loggers with the same name.

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top