---
title: Enabling Mapped Diagnostic Context for Policy Editor logs
description: You can enable Mapped Diagnostic Context (MDC) in the default Policy Editor logs for enhanced visibility of application behavior.
component: pingauthorize
version: 11.0
page_id: pingauthorize:pingauthorize_server_administration_guide:paz_pe_mdc_logging
canonical_url: https://docs.pingidentity.com/pingauthorize/11.0/pingauthorize_server_administration_guide/paz_pe_mdc_logging.html
revdate: September 27, 2024
section_ids:
  about-this-task: About this task
  steps: Steps
---

# Enabling Mapped Diagnostic Context for Policy Editor logs

You can enable Mapped Diagnostic Context (MDC) in the default Policy Editor logs for enhanced visibility of application behavior.

## About this task

MDC is a map of key-value pairs that you can use to enrich log messages. This can help when correlating log messages to a specific decision request. For example, if you want to correlate an HTTP service call recorded in the application logs to the decision request that invoked that service, you can use the `decisionRequestId` generated by MDC.

|   |                                                                                                                                                                                                               |
| - | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | MDC log data is enabled by default in the [File-based Trace Log Publisher](paz_enable_detailed_logging.html#debug_trace_logger) in [embedded policy decision point (PDP)](paz_config_embedded_pdp.html) mode. |

The following table outlines the MDC keys available for each decision request type:

| Decision request type | Key                 | Description                                                        |
| --------------------- | ------------------- | ------------------------------------------------------------------ |
| Individual requests   | `decisionRequestId` | Unique ID for the decision request.                                |
| Batch requests        | `batchId`           | Unique ID for the batch request.                                   |
|                       | `decisionRequestID` | Unique ID for an individual decision request in the batch.         |
| Policy query requests | `queryId`           | Unique ID for the policy query request.                            |
|                       | `decisionRequestID` | Unique ID for an individual decision request in the query request. |

## Steps

1. Stop the Policy Editor.

   ```
   $ bin/stop-server
   ```

2. In the `PingAuthorize-PAP/config/configuration.yml` file, add the `%mdc` configuration option to the `logFormat` field of the application log `appenders` section:

   ```
    appenders:
    - type: "console"
      threshold: "INFO"
      target: "stdout"
      logFormat: "%-5level [%date{ISO8601}] %c, %mdc: %msg%n"
    - type: "file"
      threshold: "DEBUG"
      currentLogFilename: "logs/debug.log"
      maxFileSize: "250MB"
      archive: true
      archivedLogFilenamePattern: "logs/debug.%i.log.gz"
      archivedFileCount: 10
      logFormat: "%-5level [%date{ISO8601}] [%thread] %c, %mdc: %msg%n"
    - type: "file"
      threshold: "INFO"
      currentLogFilename: "logs/authorize-pe.log"
      maxFileSize: "250MB"
      archive: true
      archivedLogFilenamePattern: "logs/authorize-pe.%i.log.gz"
      archivedFileCount: 10
      logFormat: "%-5level [%date{ISO8601}] %c,%mdc: %msg%n"
   ```

3. Save your changes and restart the Policy Editor.

   ```
   $ bin/start-server
   ```
