我使用以下配置并希望我的错误日志通过电子邮件发送,但他们不会
<targets>
<target name="traceLogger" xsi:type="File" fileName="C:\Temp\trace.log" layout="${date:format=G} ${level} ${message}"/>
<target name="warnLogger" xsi:type="File" fileName="C:\Temp\warning.log" layout="${date:format=G} ${message}"/>
<target name="infoLogger" xsi:type="File" fileName="C:\Temp\info.log" layout="${date:format=G} ${message}"/>
<target name="errorLogger" xsi:type="Mail"
subject="QC Result Processing Error"
to="name@domain.com"
bcc=""
cc=""
from="sender@domain.com"
smtpServer="smtpinfo"/>
</targets>
<rules>
<logger name="*" writeTo="traceLogger"></logger>
<logger name="*" levels="Warn" writeTo="warnLogger"></logger>
<logger name="*" levels="Info" writeTo="infoLogger"></logger>
<logger name="*" levels="Error" writeTo="errorLogger"></logger>
</rules>
答案 0 :(得分:3)
我启用了nlog异常并发现了问题。问题是空白的密送和cc。我删除了它们,电子邮件工作正常。