log4net appenders never flush their client, so events are lost at shutdown
维护者通常 6 天内回复
还没有人认领这个 Issue。
评估
调研方向
在链接的位置阅读 ExceptionlessAppender.cs 和 BufferingExceptionlessAppender.cs,然后将关闭处理与 ExceptionlessTarget.cs 进行比较。追踪每个 appender 如何创建其客户端,以及关闭缓冲区时如何提交事件;完成标准是关闭或刷新能在超时时间内处理队列中的事件,并且只释放由 appender 创建的客户端。
由索引模型根据 Issue 内容生成。
描述
In Exceptionless.Log4net 6.2.0, when ApiKey or ServerUrl is set on ExceptionlessAppender or BufferingExceptionlessAppender, the appender creates its own ExceptionlessClient with in-memory storage. Nothing ever processes that client's queue on close or flush, so events logged shortly before the process exits are never sent.
Where
- https://github.com/exceptionless/Exceptionless.Net/blob/5792f00d175f94a35fe0559c8e9999234a8163be/src/Platforms/Exceptionless.Log4net/ExceptionlessAppender.cs#L12-L27
- https://github.com/exceptionless/Exceptionless.Net/blob/5792f00d175f94a35fe0559c8e9999234a8163be/src/Platforms/Exceptionless.Log4net/BufferingExceptionlessAppender.cs#L17-L34
For comparison, the NLog target flushes its client: https://github.com/exceptionless/Exceptionless.Net/blob/5792f00d175f94a35fe0559c8e9999234a8163be/src/Platforms/Exceptionless.NLog/ExceptionlessTarget.cs#L96-L98
What happens
- The private client is never started, so it does not register the process-exit handler that
Startup()registers for other clients. - Neither appender overrides
OnCloseorFlush, soLogManager.Shutdown()/LogManager.Flush()do not send queued events. - The queue is only processed by the client's timer (first run after 2 seconds, then every 10 seconds). Events logged in the last few seconds before exit stay in memory and are lost. For
BufferingExceptionlessAppender, the buffer is handed to the client on close, but the client's queue is still never sent. - The client is never disposed either.
Expected
Closing or flushing the appender (for example LogManager.Shutdown()) sends the queued events, and the appender disposes a client it created.
Steps to reproduce
- Configure
ExceptionlessAppenderin log4net with<apiKey value="..." />. - In a console app, log an error and then call
LogManager.Shutdown()and exit. - The event never arrives in Exceptionless.
Suggested fix
In both appenders, override OnClose (calling the base first for the buffering appender so the buffer is submitted) and Flush(int millisecondsTimeout) to call _client.ProcessQueueAsync() and wait up to the timeout, and dispose the client in OnClose when the appender created it.
- 主要语言
- C#
- 星标
- 573
- 派生
- 143
- 平均合并
- 5 天 9 小时
- 30 天内合并 PR
- 1
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
exceptionless/Exceptionless.Net 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
exceptionless/Exceptionless.Net#391 ·
维护者通常 6 天内回复
-
bug
难度 1/5 1-3 小时 新手友好度 88/100
exceptionless/Exceptionless.Net#387 ·
维护者通常 6 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
exceptionless/Exceptionless.Net#386 ·
维护者通常 6 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 35/100
exceptionless/Exceptionless.Net#389 ·
维护者通常 6 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 72/100
exceptionless/Exceptionless.Net#388 ·
维护者通常 6 天内回复
查看 exceptionless/Exceptionless.Net 的全部 Issue
相似的 Issue
-
bug 優先: 低
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
-
.NET area: storage bug good first issue
难度 2/5 1-3 小时 新手友好度 78/100
Larson-Logan/medal-sync#61 ·
维护者通常 1 天内回复
-
area-ai bug untriaged
难度 2/5 1-3 小时 新手友好度 67/100
dotnet/extensions#7893 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100