-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add trace log for HTTP error responses #5795
Add trace log for HTTP error responses #5795
Conversation
src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opentripplanner/framework/io/JsonDataListDownloader.java
Outdated
Show resolved
Hide resolved
Discussed in today's meeting: it's not clear how to proceed. The original concern that was voiced about logging here is that the HttpClient is a "framework class" that could be used in many different places throughout the project. Turning on trace-level logging could produce an overwhelming amount of messages that are not limited to the one usage site that one is trying to debug. The original implication was that framework-like classes should return enough information (or throw exceptions specific enough) so the caller can log errors in a more context-specific way. There were some reasons why this didn't work in this particular case: it would result in too much boilerplate logging calls and checked exception handling at every call site, and the return types would have to be overly complex or incur significant overhead for logging facilities that are rarely used. So the remaining solution was to pass the caller's logger into the framework's methods. However, this goes against most people's expectations when the loggers are assigned names that are the fully-qualified names of classes. We observed that it's common for Java library code (e.g. database or HTTP tooling) to emit its own debugging log messages using its own logger, and that the (sometimes surprisingly complex) Java logging world is apparently designed to work this way (each library calls a logging API which are all routed to the top level application's logging implementation). So what we are looking for is widespread Java conventions for debug and trace level logging within a library (or project-specific framework code) where logging messages can be filtered by call site or use case. |
src/main/java/org/opentripplanner/framework/io/JsonDataListDownloader.java
Show resolved
Hide resolved
I've now done refactoring based on last weeks discussion but there are few classes I'm still slightly unhappy with as I've explained in #5795 (comment) . |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5795 +/- ##
==========================================
Coverage 67.85% 67.86%
- Complexity 16546 16562 +16
==========================================
Files 1906 1909 +3
Lines 72291 72388 +97
Branches 7444 7446 +2
==========================================
+ Hits 49055 49128 +73
- Misses 20716 20739 +23
- Partials 2520 2521 +1 ☔ View full report in Codecov by Sentry. |
Summary
Removes OtpHttpClient's own logger and passes in loggers from where it's used from. Adds a trace log for http responses in case there is an error response coming from an external API.
Issue
closes #5761
Unit tests
New tests will not be added.
Documentation
Not needed
Changelog
Not sure if needed