【问题标题】:AWS cloudwatch throws ResourceNotFoundException when removing active Log StreamsAWS cloudwatch 在删除活动日志流时抛出 ResourceNotFoundException
【发布时间】:2023-03-12 22:30:01
【问题描述】:

我正在使用 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

【问题讨论】:

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


【解决方案1】:

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

https://www.nuget.org/packages/AWS.Logger.NLog/

另见:https://github.com/aws/aws-logging-dotnet/issues/134

【讨论】:

    猜你喜欢
    • 2019-12-24
    • 2017-09-03
    • 1970-01-01
    • 2020-05-21
    • 1970-01-01
    • 2022-10-04
    • 2018-08-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多