---
schema_version: "1"
id: b42049a69a1167fade9af2bfd224ceb47583f21979571d825ea5e490013abe80
title: Configuring Policy Logging
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/pdk/1.8/policies-pdk-configure-features-logging.md
canonical_url: https://docs.mulesoft.com/pdk/1.8/policies-pdk-configure-features-logging
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 4372382607a2e34e789468b41e8f2157fc79e29f918a0f16bcafea0b09cef8d5
description: MuleSoft Documentation Site
release: "1.8"
latest: false
---
---
product: Omni Gateway Policy Development Kit (PDK)
version: 1.8
---

# Configuring Policy Logging

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Omni Gateway Policy Development Kit (PDK) provides a logging mechanism that generates a log message
enriched with the API instance ID, policy ID, and request ID.

Insert custom logs with the following macros by using the `pdk::logger;` package:

- `logger::debug!`

- `logger::info!`

- `logger::warn!`

- `logger::error!`

The macros behave the same as the
[Rust std::format! macro](https://doc.rust-lang.org/std/macro.format.html). The first parameter must
be a format string literal. Use `{}` in the literal to pass parameters, for example:

```Rust
use pdk::logger;

// [...]

let value = "there!";
logger::debug!("Hello there!");
logger::info!("Hello {}", value);
logger::warn!("Hello {value}");
logger::error!("Hello {}", "there!");
```

All examples appear in the Omni Gateway logs in the following format:

\[flex-gateway-envoy\]\[<log-level>\] wasm log <policy-name>.<api-instance-name> main: \[policy:
<policy-name>\]\[api: <api-instance-name>\]\[req: <request-id> \] Hello there!

For more information about viewing Omni Gateway logs, see
[Monitoring Omni Gateway](https://docs.mulesoft.com/gateway/latest/gateway-monitor).
