删除活动日志流时,AWS cloudwatch会引发ResourceNotFoundException

时间:2020-08-26 10:23:23

标签: logging .net-core amazon-cloudwatch nlog

我正在使用NLog从我的应用程序(.net core 3.1)记录到云监视,当我清除了一些日志流以使其不断抛出异常时,就会发生此问题。

异常:Amazon.CloudWatchLogs.Model.ResourceNotFoundException as指定的日志流不存在,并且正在NLog内部日志文件中进行无限制写入。我可以通过停止并重新启动应用程序来使它正常工作,以免它会创建新的日志流,但是我认为这不是一个合适的解决方案,对您的帮助也将不胜感激

Exception: Amazon.CloudWatchLogs.Model.ResourceNotFoundException: The specified log stream does not exist.
 ---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
   at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
   at Amazon.Runtime.Internal.HttpHandler`1.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.Unmarshaller.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
   --- End of inner exception stack trace ---
   at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException(IExecutionContext executionContext, HttpErrorResponseException exception)
   at Amazon.Runtime.Internal.ErrorHandler.ProcessException(IExecutionContext executionContext, Exception exception)
   at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.CredentialsRetriever.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
   at AWS.Logger.Core.AWSLoggerCore.SendMessages(CancellationToken token)
   at AWS.Logger.Core.AWSLoggerCore.Monitor(CancellationToken token)
  • 内部版本:AWS.Logger.NLog 1.5.2,NLog 4.7.2,NLog.Web.AspNetCore4.9.2
  • 操作系统信息:Windows 10
  • 构建环境:Visual Studio 2019
  • 目标.NET平台:.NET Core 3.1

1 个答案:

答案 0 :(得分:1)

AWS.Logger.NLog版本。现在已发布2.0.1,并更好地处理了ResourceNotFoundException

which is the replacement of the with_sequence

另请参阅:https://www.nuget.org/packages/AWS.Logger.NLog/

相关问题