Reputation: 3807
My question is similar to these two:
but I am not able to send SMTPs at all, and I do not want to put the <appender-ref ref="SMTPAppender" />
inside the root logger. If i did, i would receive emails from every logger. So the SMTPAppender is able to send SMTPs but I just want the notificationLogger to be the only logger sending emails.
Here is my log4j2.xml file:
<loggers>
<logger name="notificationLogger" level="fatal" additivity="false">
<appender-ref ref="SMTPAppender" />
<appender-ref ref="stdout" />
</logger>
<logger name="com.prod" level="INFO">
<appender-ref ref="RollingFile"/>
</logger>
<root level="INFO">
<appender-ref ref="stdout"/>
</root>
</loggers>
What do i do in order to have the notificationLogger be the only logger sending SMTPs?
Upvotes: 0
Views: 2172
Reputation: 3807
I had to update my maven dependencies to fix a known bug.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.0-beta9</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.0-beta9</version>
</dependency>
Upvotes: 0
Reputation: 39457
Not an expert on this but...
Isn't this a known bug?
https://issues.apache.org/jira/browse/LOG4J2-310
Upvotes: 1