【发布时间】: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