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

# 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).
