如何解决删除活动日志流时,AWS cloudwatch会引发ResourceNotFoundException
我正在使用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
解决方法
AWS.Logger.NLog版本。现在已发布2.0.1,并更好地处理了ResourceNotFoundException
:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。