Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-795

[SPIKE] Investigate logging for HTTP requests and responses

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      Swatch does not have an easy way to enable the application to log HTTP requests and responses.

      Goals:

      1. unique request ID
      2. the HTTP request path
      3. processing time
      4. 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

      https://github.com/candlepin/candlepin/tree/master/src/main/java/org/candlepin/servlet/filter/logging

      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/blob/master/src/main/java/org/candlepin/logging/LoggerAndMDCFilter.java

      https://github.com/candlepin/candlepin/commit/e386c8f7ca523496c4361de1bf19a4b41c202203

       

            karshah@redhat.com Kartik Shah
            awood1@redhat.com Alex Wood
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: