Skip to content

Log Levels and Correlation IDs

Kilemonn edited this page Jan 15, 2024 · 2 revisions

Correlation IDs

By default the application will generate and log a new UUID specific for each new request. This same UUID will also be returned in success and failure response messages. However if you wish, you can provide a custom Correlation ID in any request by providing it in as the following header value X-Correlation-Id.

The application is not responsible for ensuring that all provided X-Correlation-Id are unique if they are provided by the caller. This can lead to confusion if you do not have a way to ensure that the caller does not provide duplicate X-Correlation-Id values.


Changing Log Levels - Package Level

Spring - Custom Log Levels

If you require further logging from the running application you can change logging levels for specific packages via the environment variables, which will inturn be picked up by the application.

This is not specific to the MultiQueue implementation and can be done with any running spring application.

Firstly you need to create a new logging group by adding logging.group.<my-logging-group> as the property name this will create the logging group. The value for this property is a list of class names that should be included in this group, e.g. au.kilemon.messagequeue. Once the group is created the appropriate package names are added to the group, you can define another property: logging.level.<my-logging-group> the value for this property is the log level to set for the group, e.g. TRACE.

If you want to set the MultiQueue log messages to trace you can use the following example docker compose configuration, using messagequeue as the logging group name:

version: "3.9"
services:
  queue:
    image: kilemon/message-queue
    ports:
      - "8080:8080"
    environment:
      message-queue.storage-medium: IN_MEMORY
      message-queue.restriction-mode: NONE
      logging.group.messagequeue: au.kilemon.messagequeue
      logging.level.messagequeue: TRACE

Once the application starts the log levels will be picked up and the appropriate logs of the provided log level will be captured in the appropriate log files.

Clone this wiki locally