I have configured a SMTP appender to send an email whenever there’s an error.
<appender name="EmailAppender">
<bufferSize value="50" />
<lossy value="false" />
<threshold value="ALL" />
<evaluator type="log4net.Core.LevelEvaluator,log4net">
<threshold value="ERROR" />
</evaluator>
</appender>
I need to also get an email when an operation (which is not an error) is completed. I can in theory log this as an error and get an email but in reality it’s not an error but an indication that an operation has been completed (More like an INFO).
Should I add another SMTP appender?
You should be able to change
<threshold value="ERROR"/>to<threshold value="INFO"/>. This appender will then deliver emails for INFO, WARN, ERROR and FATAL.If you need a custom level, you can use something like:
See this question for more information on how to filter with custom levels. Apache provides more information on levels here.