Details
-
Task
-
Status: Closed (View Workflow)
-
P3
-
Resolution: Done
-
None
-
-
CP: sprint 100
-
2
-
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).