Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
oleg-semenov opened this issue Jan 5, 2023 · 0 comments

Comments

@oleg-semenov
Copy link

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.

@oleg-semenov oleg-semenov changed the title Ability to pass an instance of IOExceptino to HttpIOExceptionHandler or log the exception in HttpRequest when HttpTransport.LOGGER level is above CONFIG Ability to pass an instance of IOExceptino to HttpIOExceptionHandler OR log the exception in HttpRequest when HttpTransport.LOGGER level is above CONFIG Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant