---
schema_version: "1"
id: 3d6af1ac881a9a4f7a5eb2d956dab3376a5ec4b56a63412788463dedfcdb040d
title: Configuring Message Logging for Managed Omni Gateway
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/latest/managed-message-log.md
canonical_url: https://docs.mulesoft.com/gateway/latest/managed-message-log
source_site: docs.mulesoft.com
content_type: documentation
content_hash: cd8dd211c551ac456cfc033caaa740dbd9f529ad2da7ff5e125a08b90e6d4b78
description: MuleSoft Documentation Site
release: "1.14"
latest: true
---
---
product: Omni Gateway
version: 1.14
is-latest-version: true
---

# Configuring Message Logging for Managed Omni Gateway

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

Applying a Message Logging policy to your API instance in API Manager allows you to view basic logs,
such as inbound and outbound calls and headers, for APIs managed by Omni Gateway within API Manager.
Logging for an API instance only happens if you configure and apply a Message Logging policy.

To view metrics in API Manager, such as total requests, total policy violations, total errors, and
average response time, see
[Viewing Key Metrics in API Manager for Managed Omni Gateway](https://docs.mulesoft.com/gateway/latest/managed-view-api-metrics).

> [!NOTE] To use multiple log levels for different configurations, add multiple configurations
> within a single Message Logging policy. To learn more, see
> [Configuring Multiple Log Levels](#multiple-log-levels).

## Message Logging Limits and Features

API Manager stores up to 100 MB of logs per API instance for 30 days. Runtime Manager automatically
purges logs that go beyond 100 MB per API instance. If you need more storage, sign up for the
Anypoint Integration Advanced package or a Titanium subscription to Anypoint Platform.

Basic logs report this information for each API instance configured through a policy:

- Inbound and outbound API calls, as well as the packet contents

- Headers and any other information in the request

To view message logs in API Manager, you need one of the following permissions:

- API Manager Environment Administrator

- API Manager Deploy API Proxies

- General Organization Administration

Refer to
[Permissions by Product in Anypoint Platform](https://docs.mulesoft.com/access-management/permissions-by-product).

## Configure Message Logging

1.  From **API Instances** in API Manager, select the name of the API Instance.

2.  Click **Policies**.

3.  Click **\+ Add policy**.

4.  Click **Message Logging** in the **Troubleshooting** category.

5.  Click **Next**.

6.  Click **\+ Add**.

7.  Enter a **Configuration Name**, for example, 'Info messages before calling API'.

8.  Enter a DataWeave expression that selects what information you want to see.

    For example, `#[attributes.headers['id']]` extracts the ids from the headers of the messages.
    For more information, see
    [DataWeave Support in Omni Gateway Policies](https://docs.mulesoft.com/gateway/latest/policies-dataweave-support).

9.  If you want to filter log messages, enter a DataWeave expression.

    For example, `#[attributes.headers['id']==1]` shows log messages that have an id of 1 in the
    header.

10. If you want to affix a prefix to your logs, enter a **Category**.

11. Enter the severity level.

    You can only enter one level. See [Message Logging Severity Levels](#severity-levels) for a
    description of each severity level and the hierarchy for the levels.

12. If you want messages after the API is called, select **After Calling API**.

13. If you want to add additional configurations, click **\+ Add**. For more information about
    configuring multiples levels, see [Configuring Multiple Log Levels](#multiple-log-levels).

14. Click **Save**.

    Afterward, you should see a **Message Log** option for the API instance.

    Use the search field to search for specific logs based on the time and log severity (INFO,
    ERROR, WARN, DEBUG). You can download these logs for further analysis.

### Configuring Multiple Log Levels

To log messages at multiple levels or with different conditions within a single Message Logging
policy:

1.  Apply one Message Logging policy to your API instance following the steps at
    [Configure Message Logging](#configure-message-logging).

2.  Configure the first logging entry with your desired settings (for example, **Level**: INFO).

3.  Click **\+ Add** to add another configuration.

4.  Configure the second logging entry with different settings (for example, **Level**: ERROR).

5.  Repeat steps 3-4 to add additional configurations as needed.

6.  Click **Save**.

For example, if you configure the parameter:

- **First configuration**:

  - **Message**: `#[payload]`

  - **Level**: INFO

  - **Before Calling API**: Selected

- **Second configuration**:

  - **Message**: `#[attributes.headers]`

  - **Level**: ERROR

  - **After Calling API**: Selected

This configuration logs the request payload at INFO level before calling the API and logs response
headers at ERROR level after calling the API.

## Message Logging Severity Levels

When you configure a Message Logging policy for your API instance, you can assign a severity level.
Each severity level includes a specific set of information in the log report.

Log reports include the severity level you select and the following levels on the hierarchy.

For example, if you select DEBUG, the log reports include the DEBUG severity level as well as the
INFO, WARN, and ERROR severity levels. However, if you select ERROR, the log reports include only
error messages. The following table describes the type of information included in the logs for each
severity level:

<table><colgroup><col> <col></colgroup><thead><tr><th>Log Severity Level</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p>DEBUG</p></div></div></td><td><div><div><p>Tracing information used by application developers.</p></div></div></td></tr><tr><td><div><div><p>INFO</p></div></div></td><td><div><div><p>Informational messages that highlight the progress of the application.</p></div></div></td></tr><tr><td><div><div><p>WARN</p></div></div></td><td><div><div><p>Potentially harmful situations that indicate potential problems.</p></div></div></td></tr><tr><td><div><div><p>ERROR</p></div></div></td><td><div><div><p>Events that prevent normal program execution but might allow the application to continue running.</p></div></div></td></tr></tbody></table>
