Log4Net / LogEntries降低了我们的生产站点

时间:2016-09-15 12:58:05

标签: asp.net iis log4net logentries

今天早上我们发生了一起非常可怕的事件。我们的QA团队(幸运的是,在美国工作日开始之前开始工作)报告说我们的生产网站突然出现故障。那时我们没有做过什么奇怪的事;失败是突然的,同时影响了我们所有的环境。我进入生产Web服务器(IIS),发现应用程序池已停止。我重新启动它,它立即再次崩溃。我检查了Windows事件查看器,并在日志中发现以下错误:

来源:.NET Runtime

  

应用程序:w3wp.exe

     

框架版本:v4.0.30319

     

描述:由于未处理的异常,该进程已终止。

     

异常信息:System.Security.Authentication.AuthenticationException   堆:      在System.Net.Security.SslState.ForceAuthentication(Boolean,Byte [],System.Net.AsyncProtocolRequest)      在System.Net.Security.SslState.ProcessAuthentication(System.Net.LazyAsyncResult)      在System.Net.Security.SslStream.AuthenticateAsClient(System.String)      在LogentriesCore.AsyncLoggerBase.Run()      在System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,Boolean)      在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,Boolean)      在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object)      在System.Threading.ThreadHelper.ThreadStart()

来源:ASP.NET 4.0.30319.0

  

发生了未处理的异常,并且该过程已终止。

     

申请ID:/ LM / W3SVC / 1 / ROOT

     

流程ID:10156

     

异常:System.Security.Authentication.AuthenticationException

     

消息:根据验证程序,远程证书无效。

     

StackTrace:at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message,AsyncProtocolRequest asyncRequest,Exception exception)      在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst,Byte [] buffer,AsyncProtocolRequest asyncRequest)      在System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)      在System.Net.Security.SslStream.AuthenticateAsClient(String targetHost)      在LogentriesCore.AsyncLoggerBase.Run()      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx)      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx)      在System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback回调,对象状态)      在System.Threading.ThreadHelper.ThreadStart()

此堆栈跟踪不包含任何我们自己的代码;对我来说唯一有意义的是关于Logentries的一点点。所以我马上打开了web.config文件并在Log4Net配置中注释掉了以下一行:

<appender-ref ref="LeAppender" />

其中LeAppender之前定义为

<appender name="LeAppender" type="log4net.Appender.LogentriesAppender, LogentriesLog4net">
  <UseHttp value="false" />
  <UseSsl value="true" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date %-5level %logger [host=%P{log4net:HostName}:appdomain=%appdomain:referenceid=%property{referenceid}] - %message%newline" />
  </layout>
</appender>

我重新启动了网站,一切都重新开始了,我们的客户也没有更聪明;很幸运,这一切都发生了,并在工作时间之前得到了解决(但它很接近!)。

这完全让我感到害怕。在我看来,Log4Net应该是一个完全可靠的框架,不会造成任何损害。在我看来,Logentries有一个证书到期(或类似的东西),其效果立即导致我们的生产网站崩溃!

我们的Log4Net / Logentries设置有问题吗?

初始配置(不知道这可能有什么问题):

XmlConfigurator.Configure();

记录器本身是ILog,它的分配方式如下:

_log = LogManager.GetLogger("Logger");

并且记录完成如下:

_log.Logger.Log(typeof(MyLogger), level, message, ex);

这里没什么不好的。它已经工作了一年多了。此外,正如我之前提到的,堆栈跟踪没有任何对我们自己的代码的引用,所以它可能不是由于我们编写的任何错误代码。

任何想法出了什么问题,如何修复它,以及如何确保这种中断永远不会让我们的系统再次崩溃?

1 个答案:

答案 0 :(得分:1)

&#34; 9月14日,为api.logentries.com发布了新的SSL证书。由于约束,这些证书与之前为api.logentries.com提供的旧证书不匹配。我们建议所有当前正在嵌入旧的api.logentries.com证书的用户切换到使用您的系统证书池。有关更改设置的帮助,请联系support@logentries.com&#34;

此消息本应在您今天首次登录日志条目时显示。这就是你今天的问题开始的原因。

如果您将log4net软件包升级到最新版本,并将您的logentries软件包升级到最新软件包,则问题将得到解决。