简体   繁体   English

Log4Net Outlook配置

[英]Log4Net Outlook config

I have reviewed the topics related to this topic. 我已经审查了与此主题相关的主题。 But I could not find the answer. 但是我找不到答案。 I use the following code to send errors via Log4Net as "Error". 我使用以下代码通过Log4Net将错误发送为“错误”。 Where am I going to make the mistake? 我要在哪里犯错?

<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender,log4net">
  <from value="from@outlook.com" />
  <to value="to@gmail.com" />
  <subject value="ErrorLogmessage" />
  <smtpHost value="smtp-mail.outlook.com" />
  <authentication value="Basic" />
  <port value="587" />
  <username value="from@outlook.com" />
  <password value="realpassword" />
  <bufferSize value="1" />
  <lossy value="false" />
  <evaluator type="log4net.Core.LevelEvaluator,log4net">
    <threshold value="ERROR"></threshold>
  </evaluator>
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" />
  </layout>
</appender>
<root>
  <level value="ERROR"/>
  <appender-ref ref="SmtpAppender"/>
</root>

You are missing the property: 您缺少该属性:

<enableSsl value="true"/>

Make sure you are using the latest log4net version. 确保您使用的是最新的log4net版本。

Also enable internal debugging if it fails. 如果失败,也请启用内部调试。 That will give you more insights in what is going on in log4net and why it fails. 这将使您对log4net中发生的事情以及失败的原因有更多的了解。

log4net faq => enable internal debugging log4net常见问题=>启用内部调试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM