Skip to main content

Logging Configuration

Logging Overview

When a request is received by the application, the following properties of the request are logged via Spring’s Mapping Diagnostic Context (MDC):

  • @timestamp - timestamp when the request was received
  • level - logging level (INFO, WARN, ERROR etc.)
  • logger_name - logger (the fully-qualified class name where the logger was called)
  • message - logged message (message passed to the logger)
  • request_id - a UUID is created to identify the request. Any logs that are made during the evaluation of this request will be tagged with this request ID.
  • http_method - the HTTP verb of the request (i.e. GET, POST, etc.)
  • request_uri - the path of the request (i.e. /some-endpoint)
  • client_ip - the IP address of the client making the request

The preceding properties will also be logged whenever a logging event occurs during the processing of a request (not just when the request is received).

When a response is made by the application, it will log the same properties as it did when the request was received. In addition, the application logs the following properties specific to the response:

  • stack_trace - exception stack trace (if an exception occurred)
  • http_status - the outcome of the request (always logged)
  • alert_level - the exception alert level (if an exception occurred)
  • error_code - the exception lookup code (if an exception occurred)
  • exception_message - the exception message (if an exception occurred)

Configuration

Logging configuration can be found in the Helm chart's application.config section, under the logging property. The config file specified by default, logback-spring.xml (under logging.config), is set up to log in a compressed (single-line per log event) JSON format which is more digestible by tools utilized by DevOps in order to parse log data for diagnostics. The following config files may be specified for different log formats:

  • logback-spring.xml: JSON formatted output for production environments.
  • logback-dev.xml: Human-readable output for development purposes.

See the Deployment section for more details on these properties.

More information about Logback configuration and syntax can be found here:

https://logback.qos.ch/manual/configuration.html

More information about how to configure the Logstash encoder used in the Logback configuration can be found here:

https://github.com/logfellow/logstash-logback-encoder