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

Abierto
#1,798 0 comentarios 0 reacciones 0 asignados Ver en GitHub
type: feature request
Lenguaje dominante
Java
Estrellas
1.4k
Forks
473
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.