---
schema_version: "1"
id: 3d6259e2e951027cc8cbb1f71ee9ac67fb8c9d58b658831d3db7aebf42ee8bea
title: Configuring Message Logging for Flex Gateway in Connected Mode
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/1.12/flex-conn-message-log.md
canonical_url: https://docs.mulesoft.com/gateway/1.12/flex-conn-message-log
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 497a695bbae7a086c694669b49ea22d013df3bb2d6c34440961086f2d1c543a0
description: MuleSoft Documentation Site
release: "1.12"
latest: false
---
---
product: Omni Gateway
version: 1.12
---

# Configuring Message Logging for Flex Gateway in Connected Mode

> 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 Flex 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 Flex Gateway in Connected Mode](https://docs.mulesoft.com/gateway/1.12/flex-conn-view-api-metrics).

## 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 in Connected Mode

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 Flex Gateway Policies](https://docs.mulesoft.com/gateway/1.12/policies-flex-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**.

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.

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