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

# Configuring Policy Logging

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

Flex 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 Flex 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 Flex Gateway logs, see
[Monitoring Omni Gateway](https://docs.mulesoft.com/gateway/latest/gateway-monitor).
