-
Task
-
Resolution: Done
-
Normal
-
None
-
None
-
False
-
-
False
-
-
Swatch does not have an easy way to enable the application to log HTTP requests and responses.
Goals:
- unique request ID
- the HTTP request path
- processing time
- a way to enable these loggers at runtime
Done:
- option(s) presented to team during dev sync
- cards created after presentation
Initial criteria:
We should be able to set one or two loggers to debug and the loggers should log the entire HTTP request and response. Whether to use one or two loggers will have to be a technical decision, but there is a requirement for enabling them should just be a one liner. We can do this by placing both (if there are two) in one package and doing something like "logging.level.org.candlepin.subscriptions.http=DEBUG"
Request and response logging functionality that we are seeking to imitate
Spring has some Servlet extensions that obviate the need for the Tee* classes, I believe. See https://www.baeldung.com/spring-http-logging
We should look for spring-boot and quarkus (future planning).
There may also be Boot tools that can handle all of this for us. See https://stackoverflow.com/a/39234957
A thorough search of possible off-the-shelf solutions should be conducted.
After this is completed, we should then provide a way to enable these loggers at runtime so that QE can enable the loggers before they run their tests and create a record of their requests. We have done something similar in Candlepin with a logging endpoint where authorized users can POST and org ID and log level to Candlepin and logging will be turned to that level for that org. This should be an admin only function and needs to integrate with the existing security structure.
See:
https://github.com/candlepin/candlepin/commit/e386c8f7ca523496c4361de1bf19a4b41c202203