Uploaded image for project: 'Okapi'
  1. Okapi
  2. OKAPI-910

Cleanup ProxyContext logging

    XMLWordPrintable

    Details

    • Template:
    • Sprint:
      CP: sprint 100
    • Story Points:
      2
    • Development Team:
      Core: Platform

      Description

      • Remove error, warn, debug and trace methods from ProxyContext
      • Rewrite code to suppress unnecessary log message computation.

      ProxyContext has this logging code:

      private final Logger logger = OkapiLogger.get();
      
      public void error(String msg) {
          logger.error(msg);
        }
      
        public void warn(String msg) {
          logger.warn(msg);
        }
      
        public void warn(String msg, Throwable e) {
          logger.warn(msg, e);
        }
      
        public void debug(String msg) {
          logger.debug(msg);
        }
      
        public void trace(String msg) {
          logger.trace(msg);
        }
      

      This is used by ProxyService, TenantManager, RoutingEntry.

      ProxyContext and the other three classes can each create a private static final Logger logger = OkapiLogger.get() and use it directly. There is no need call ProxyContext for logging.

      Unnecessary computation should be suppressed using log4j features. Example:

       
      pc.debug(prefix + "Validating RoutingEntry " + Json.encode(this));
      

      Log4j lazy lambda evaluation suppresses the JSON encoding if debug log level is disabled:

      logger.debug("{} Validating RoutingEntry {}", prefix, () -> Json.encode(this));
      

      The stack trace should be logged by replacing error(message) by error(message, exception).

        TestRail: Results

          Attachments

            Activity

              People

              Assignee:
              adam Adam Dickmeiss
              Reporter:
              julianladisch Julian Ladisch
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  TestRail: Runs

                    TestRail: Cases