fluent / fluent/fluent-logger-java

Improving error handling

未关闭
#15 15 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
210
派生
86
PR 合并指标
30 天内没有已合并 PR

描述

I and @komamitsu san discussed how to improve error reporting of the current 0.2.x versions.

The major changes we considered are:
- Add `setHandler(handler)` method to FluentLogger to accept an application-specific error handler.
- In the error handler, provide a method for retrieving the remaining logs (the last one or all logs) that are not yet sent to fluentd.
- The last logs are message packed Event objects. We need to provide a decoder so that the last log is meaningful to the user.

In this change, we should consider the following problem:
- (Plan 1) A timing to report error. Currently errors can be reported in three ways: return value of `log` method (true or false), unmanaged exceptions or exceptions thrown when the buffer is full. If an error handler is added, `log` method should be **non-blocking** method, and the error must be handled in the user-defined error handler (in the subsequent code or in another thread). Does it the right choice?

Another option would be:
- (Plan 2) Making `log` a **blocking** method and reporting errors by Exception rather than returning true or false. The last log event should be included in the thrown exception.

After writing this ticket, Plan 2 now looks simpler to me.
Any idea?

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。