更換
<threshold value="FATAL"/>
我建議把以下到您的appSettings節點。
<appSettings>
<add key="log4net.Internal.Debug" value="true"/>
</appSettings>
它將然後輸出診斷諸如
log4net: Setting Property [From] to String value [[email protected]]
log4net: Setting Property [Subject] to String value [Kodiak OMS Shortcode service]
log4net: Setting Property [SmtpHost] to String value [mail.sip.is]
log4net: Setting Property [Port] to Int32 value [25]
log4net: Setting Property [BufferSize] to Int32 value [1]
log4net: Setting Property [EnableSsl] to Boolean value [True]
log4net: Setting Property [Threshold] to Level value [DEBUG]
log4net: Setting Property [Lossy] to Boolean value [False]
log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Setting Property [ConversionPattern] to String value [%utcdate [%level] - %message%newline%exception]
log4net: Converter [utcdate] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [ [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [level] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [] - ] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [exception] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Setting Property [Layout] to object [log4net.Layout.PatternLayout]
log4net: Created Appender [EmailLog]
log4net: Adding appender named [EmailLog] to logger [EmailLogger].
log4net: Hierarchy Threshold []
log4net:ERROR [SmtpAppender] ErrorCode: GenericFailure. Error occurred while sending e-mail notification.
System.Net.Mail.SmtpException: Server does not support secure connections.
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at log4net.Appender.SmtpAppender.SendEmail(String messageBody)
at log4net.Appender.SmtpAppender.SendBuffer(LoggingEvent[] events)
已添加的<附加器-REF>爲這個新的附加?添加配置文件的其餘部分。你現在發佈的內容似乎沒問題。 –
log4net的設計永遠不會拋出異常。調試輸出中有什麼? – stuartd
@TudorCarean我有。 – Z0q