googleapis / googleapis/google-http-java-client

Ability to pass an instance of IOExceptino to HttpIOExceptionHandler OR log the exception in HttpRequest when HttpTransport.LOGGER level is above CONFIG

未关闭
#1,798 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
type: feature request
主要语言
Java
星标
1.4k
派生
473
PR 合并指标
30 天内没有已合并 PR

描述

Would it be possible to access or log intermittent/retry-able IO-exceptions of the HttpRequest?

Currently the exception could be logged in https://github.com/googleapis/google-http-java-client/blob/main/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java#L1043, but only when HttpTransport.LOGGER log-level is bellow java.util.logging.Level.CONFIG (https://github.com/googleapis/google-http-java-client/blob/main/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java#L891). Changing that level affects many other logs and so doesn't work when just logging the exceptions is desirable. Would it be possible change the condition for the IOExceptions to be logged, perhaps adding a new flag like `intermittentExceptionsLoggingEnabled` similar to https://github.com/googleapis/google-http-java-client/blob/main/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java#L127?

Alternatively, instances of the IOException-s could be passed to `HttpRequest.ioExceptionHandler` in https://github.com/googleapis/google-http-java-client/blob/main/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java#L1035. However, since the project uses Java 7, simply adding an extra method that takes an IOException to HttpIOExceptionHandler with a default implementation would not work. Would it be possible to add a check in https://github.com/googleapis/google-http-java-client/blob/main/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java#L1035 to detect a special handler that accepts IOExceptions or add another handler?

I could send a pull request but probably my solution ideas are not the best.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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