# mulesoft Tracing Module - Full Documentation --- product: Tracing Module version: 1.3 is-latest-version: true --- # Add Custom Attributes to the Root Span with Tracing Module > For the full documentation index, see: https://docs.mulesoft.com/llms.txt You might want to add custom attributes to the root span of a transaction if: - You want to attach transaction-level fields, such as a client ID or conversation ID, to the primary span instead of a child span. - You want the attributes to be present on the root span regardless of how deeply nested the flow that sets them is. For these scenarios, the Tracing module **Add Root Span Attributes** operation enables you to add key-value attributes to the current transaction’s root span. This operation builds on Mule runtime’s OpenTelemetry tracing support. Before using it, see [OpenTelemetry Support in Mule Runtime](https://docs.mulesoft.com/mule-runtime/latest/otel-support) to understand traces and spans, and to configure trace export. > [!NOTE] This operation requires Mule runtime engine 4.13 or later. On earlier runtimes, it is a > no-op. ## Configure the Add Root Span Attributes Operation In the following Mule app example, you configure the **Add Root Span Attributes** operation in Anypoint Code Builder: ![A flow showing an Add Root Span Attributes operation](/mulesoft/current/en-us/tracing-module/latest/_images/tracing-module-add-root-span-attributes-flow.png) 1. In the canvas UI, click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon, search for `Listener`, and select **Listener** from the **HTTP** results. 2. On the **General** tab, set **Path** to `/test`. 3. Add an HTTP Listener configuration (``) that listens on port `8081`. See [Add a Global Configuration](https://docs.mulesoft.com/tracing-module/latest/tracing-module-config-acb#add-global-config). 4. Click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon after **Listener**, search for `Tracing`, and select **Add Root Span Attributes**. 5. On the **General** tab, set **Attributes** to `#[{'clientId': attributes.queryParams.clientId}]`: ![The Add Root Span Attributes General tab with the Attributes field set](/mulesoft/current/en-us/tracing-module/latest/_images/tracing-module-add-root-span-attributes.png) 6. Run your application. 7. In a terminal, run `curl "localhost:8081/test?clientId=example-client"`. The `clientId` attribute is added to the root span exported for this transaction when the transaction ends. ## XML for Configuring Add Root Span Attributes Paste this code into the configuration XML file of your integration project to quickly load the flow for this example into your Mule app: ```xml ``` ## Behavior and Limitations The root span is exported when the transaction ends, so attributes added anywhere on the synchronous path of the flow are included in it. However, a span cannot be modified after it has already been exported, which leads to the following limitations: - **Do not use this operation inside an `async` scope.** The `async` scope’s span is a child of the flow (root) span, in the same local trace, so the root does not move to the async branch. The problem is timing: the main flow does not wait for the `async` block to finish, so the flow (root) span can be exported before or after the `async` block runs. Whether the attribute makes it onto the exported root span therefore depends on unpredictable thread scheduling: ```text mule:flow <-- ROOT SPAN (root span attributes land here) ├── mule:set-variable ├── mule:async <-- child span; runs on its own thread, same trace │ └── tracing:add-root-span-attributes <-- may run after the root span is already exported └── mule:set-variable ``` Because the outcome is not deterministic, set root span attributes from the flow’s synchronous path instead of from inside an `async` scope. - **A `flow-ref` shares the caller’s trace.** A referenced flow runs within the same local trace as its caller, so attributes that this operation sets inside a referenced flow land on the caller’s root span, not on a separate root for the referenced flow. - **Distributed traces are enriched locally.** When a request arrives with an inbound distributed trace context from a remote caller, this operation adds the attributes to this application’s own local root span, which is a child of the remote span. The attributes are never propagated back to the upstream caller’s span. - **Root span attributes survive sampling and low tracing levels.** Because the attributes are added to the root span rather than to a child span, they remain in the exported trace even when child spans are dropped by sampling, or when `mule.openTelemetry.tracer.level` is set to `OVERVIEW`, which exports only the root span. ## See Also - [OpenTelemetry Support in Mule Runtime](https://docs.mulesoft.com/mule-runtime/latest/otel-support) - [Tracing Module Examples](https://docs.mulesoft.com/tracing-module/latest/tracing-module-examples) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.0 --- # Change the Correlation ID During Flow Execution with Tracing Module > For the full documentation index, see: https://docs.mulesoft.com/llms.txt You might want to change the correlation ID of the event for a given scope or a set of operations if: - You are processing the results of a database query inside a **For Each** scope and you want to correlate the event with the register you are processing. - You are consuming a JMS message queue and you want to proceed using the JMS correlation ID for traceability purposes. For these scenarios, the Tracing module **With CorrelationID** scope enables you to modify the correlation ID during the execution of that scope. ## Configure the With CorrelationID Scope In the following Mule app example, you configure the **With CorrelationID** scope in Studio: ![With CorrelationID scope flow](/mulesoft/current/en-us/tracing-module/1.0/_images/tracing-module-scope-flow.png) 1. In the **Mule Palette** view of Studio, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. Set **Path** to `/test`. 4. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the source in the app. 5. Configure the HTTP Listener global element and click **OK**. 6. Drag a **Set Payload** component to the right of HTTP Listener. 7. Set **Value** to `some`. 8. In the **Mule Palette** view of Studio, select **Logger**. 9. Drag **Logger** to the right of Set Payload. 10. Set **Message** to `#[payload]`. 11. Set **Level** to `WARN`. 12. Drag the **With CorrelationID** scope to the Studio canvas. 13. Set **Correlation id** to `#[correlationId ++ '-EXAMPLE']`: ![With CorrelationID scope configuration window with Correlation id field](/mulesoft/current/en-us/tracing-module/1.0/_images/tracing-module-with-correlationid.png) 14. Drag another **Logger** component into the **With CorrelationID** scope. 15. Set **Message** to `#[payload]`. 16. Set **Level** to `WARN`. 17. Save and run your Mule app. 18. Test the app by running `curl localhost:8081/test` at the command line. The application output logs are: ```xml WARN 2021-03-30 16:46:11,269 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/1; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some WARN 2021-03-30 16:46:11,271 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/2/processors/0; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee-EXAMPLE] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some WARN 2021-03-30 16:46:11,274 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/3; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some ``` ## XML for Configuring With CorrelationID Scope Paste this code into your Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [Tracing Module Examples](https://docs.mulesoft.com/tracing-module/1.0/tracing-module-examples) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.1 --- # Change the Correlation ID During Flow Execution with Tracing Module > For the full documentation index, see: https://docs.mulesoft.com/llms.txt You might want to change the correlation ID of the event for a given scope or a set of operations if: - You are processing the results of a database query inside a **For Each** scope and you want to correlate the event with the register you are processing. - You are consuming a JMS message queue and you want to proceed using the JMS correlation ID for traceability purposes. For these scenarios, the Tracing module **With CorrelationID** scope enables you to modify the correlation ID during the execution of that scope. ## Configure the With CorrelationID Scope In the following Mule app example, you configure the **With CorrelationID** scope in Studio: ![A flow showing a With CorrelationID scope flow](/mulesoft/current/en-us/tracing-module/1.1/_images/tracing-module-scope-flow.png) 1. In the **Mule Palette** view of Studio, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. Set **Path** to `/test`. 4. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the source in the app. 5. Configure the HTTP Listener global element and click **OK**. 6. Drag a **Set Payload** component to the right of HTTP Listener. 7. Set **Value** to `some`. 8. In the **Mule Palette** view of Studio, select **Logger**. 9. Drag **Logger** to the right of Set Payload. 10. Set **Message** to `#[payload]`. 11. Set **Level** to `WARN`. 12. Drag the **With CorrelationID** scope to the Studio canvas. 13. Set **Correlation id** to `#[correlationId ++ '-EXAMPLE']`: ![A With CorrelationID scope configuration window with Correlation ID field](/mulesoft/current/en-us/tracing-module/1.1/_images/tracing-module-with-correlationid.png) 14. Drag another **Logger** component into the **With CorrelationID** scope. 15. Set **Message** to `#[payload]`. 16. Set **Level** to `WARN`. 17. Save and run your Mule app. 18. Test the app by running `curl localhost:8081/test` at the command line. The application output logs are: ```xml WARN 2021-03-30 16:46:11,269 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/1; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some WARN 2021-03-30 16:46:11,271 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/2/processors/0; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee-EXAMPLE] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some WARN 2021-03-30 16:46:11,274 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/3; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some ``` ## XML for Configuring With CorrelationID Scope Paste this code into your Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [Tracing Module Examples](https://docs.mulesoft.com/tracing-module/1.1/tracing-module-examples) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.2 --- # Change the Correlation ID During Flow Execution with Tracing Module > For the full documentation index, see: https://docs.mulesoft.com/llms.txt You might want to change the correlation ID of the event for a given scope or a set of operations if: - You are processing the results of a database query inside a **For Each** scope and you want to correlate the event with the register you are processing. - You are consuming a JMS message queue and you want to proceed using the JMS correlation ID for traceability purposes. For these scenarios, the Tracing module **With CorrelationID** scope enables you to modify the correlation ID during the execution of that scope. ## Configure the With CorrelationID Scope In the following Mule app example, you configure the **With CorrelationID** scope in Studio: ![A flow showing a With CorrelationID scope flow](/mulesoft/current/en-us/tracing-module/1.2/_images/tracing-module-scope-flow.png) 1. In the **Mule Palette** view of Studio, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. Set **Path** to `/test`. 4. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the source in the app. 5. Configure the HTTP Listener global element and click **OK**. 6. Drag a **Set Payload** component to the right of HTTP Listener. 7. Set **Value** to `some`. 8. In the **Mule Palette** view of Studio, select **Logger**. 9. Drag **Logger** to the right of Set Payload. 10. Set **Message** to `#[payload]`. 11. Set **Level** to `WARN`. 12. Drag the **With CorrelationID** scope to the Studio canvas. 13. Set **Correlation id** to `#[correlationId ++ '-EXAMPLE']`: ![A With CorrelationID scope configuration window with Correlation ID field](/mulesoft/current/en-us/tracing-module/1.2/_images/tracing-module-with-correlationid.png) 14. Drag another **Logger** component into the **With CorrelationID** scope. 15. Set **Message** to `#[payload]`. 16. Set **Level** to `WARN`. 17. Save and run your Mule app. 18. Test the app by running `curl localhost:8081/test` at the command line. The application output logs are: ```xml WARN 2021-03-30 16:46:11,269 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/1; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some WARN 2021-03-30 16:46:11,271 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/2/processors/0; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee-EXAMPLE] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some WARN 2021-03-30 16:46:11,274 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/3; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some ``` ## XML for Configuring With CorrelationID Scope Paste this code into your Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [Tracing Module Examples](https://docs.mulesoft.com/tracing-module/1.2/tracing-module-examples) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.3 is-latest-version: true --- # Change the Correlation ID During Flow Execution with Tracing Module > For the full documentation index, see: https://docs.mulesoft.com/llms.txt You might want to change the correlation ID of the event for a given scope or a set of operations if: - You are processing the results of a database query inside a **For Each** scope and you want to correlate the event with the register you are processing. - You are consuming a JMS message queue and you want to proceed using the JMS correlation ID for traceability purposes. For these scenarios, the Tracing module **With CorrelationID** scope enables you to modify the correlation ID during the execution of that scope. ## Configure the With CorrelationID Scope In the following Mule app example, you configure the **With CorrelationID** scope in Anypoint Code Builder: ![A flow showing a With CorrelationID scope flow](/mulesoft/current/en-us/tracing-module/latest/_images/tracing-module-scope-flow-acb.png) 1. In the canvas UI, click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon, search for `Listener`, and select **Listener** from the **HTTP** results. 2. On the **General** tab, set **Path** to `/test`. 3. Add an HTTP Listener configuration (``) that listens on port `8081`. See [Add a Global Configuration](https://docs.mulesoft.com/tracing-module/latest/tracing-module-config-acb#add-global-config). 4. Click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon after **Listener**, search for `Set Payload`, and select it. 5. On the **General** tab, set **Value** to `some`. 6. Click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon after **Set Payload**, search for `Logger`, and select it. 7. On the **General** tab, set **Message** to `#[payload]` and **Level** to `WARN`. 8. Click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon after **Logger**, search for `Tracing`, and select **With CorrelationID**. 9. On the **General** tab, set **Correlation id** to `#[correlationId ++ '-Example']`: ![The With CorrelationID scope General tab with the Correlation id field set](/mulesoft/current/en-us/tracing-module/latest/_images/tracing-module-with-correlationid-acb.png) 10. Inside the **With CorrelationID** scope, click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon, search for `Logger`, and select it. 11. On the **General** tab, set **Message** to `#[payload]` and **Level** to `WARN`. 12. Run your application in debug mode. 13. In a terminal, run `curl localhost:8081/test`. The application output logs are: ```xml WARN 2021-03-30 16:46:11,269 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/1; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some WARN 2021-03-30 16:46:11,271 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/2/processors/0; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee-Example] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some WARN 2021-03-30 16:46:11,274 [[MuleRuntime].uber.05: [test-project-app].example.CPU_LITE @6d3b5ad] [processor: example/processors/3; event: bad0e5b0-9191-11eb-a0b3-36548d51aeee] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: some ``` ## XML for Configuring With CorrelationID Scope Paste this code into the configuration XML file of your integration project to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [Tracing Module Examples](https://docs.mulesoft.com/tracing-module/latest/tracing-module-examples) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.0 --- # Configure Tracing Module Logging Variable Operations > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The Tracing module **Clear logging variables**, **Remove logging variable** and **Set logging variable** operations enable you to enhance your logs by adding, removing, and clearing variables from the logging context of a single Mule event. Mapped Diagnostic Context (MDC) enriches logging and improves tracking by providing more context or information in the logs for the current Mule event. By default, Mule logs two MDC entries: `processor`, which shows the location of the current event, and `event`, which shows the correlation ID of the event. ## Before You Begin To use the Tracing module logging operations, complete the following tasks: - Add the module to your Mule project. - Change the pattern layouts in the `log4j.xml` file to `MDC`. ## Add the Module to Your Mule Project Add Tracing module to your Mule project to automatically populate the XML code with the module’s namespace and schema location and to add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `tracing` in the search field. 3. Click **Tracing Module** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. ## Change the Pattern Layouts in the log4j.xml File This change instructs Mule to automatically add the MDC context, which includes the correlation ID and the processor path. To make the change, modify `log4j.xml` in your Mule app or within `/conf/log4j2.xml` in your Mule instance. Follow these steps to change the pattern layouts to MDC: 1. Open the `log4j.xml` file for editing. 2. Replace `[processor: %X{processorPath}; event: %X{correlationId}]` with `[%MDC]`. ### Example log4j.xml File Configurations Example: Default log4j.xml file without MDC logging. Example: Updated log4j.xml file with MDC logging. ## Configure Tracing Module Operations in Studio To configure the logging variables operations, add any of the available operations **Clear logging variables**, **Remove logging variable** or **Set logging variables** to your Mule app flow and specify the corresponding attributes. In the following example, you configure the **Set logging variables** operation: 1. In the **Mule Palette** view of Studio, select **Tracing > Set logging variable** 2. Drag **Set logging variable** to your Mule app. 3. Set **Variable name** to `testVar`. 4. Set **Value** to `testValue`. ![Set logging variable operation configuration window](/mulesoft/current/en-us/tracing-module/1.0/_images/tracing-module-set-logging-variable.png) In the Configuration XML editor, the `` configuration looks like this: ```xml ... ... ``` After executing the flow, the output logs are: INFO 2021-04-08 16:58:26,882 \[\[MuleRuntime\].uber.15: \[test-project-app\].exampleFlow.CPU\_LITE @18f679\] \[{correlationId=c85e16c0-98a4-11eb-bc34-cac765a2219b, processorPath=exampleFlow/processors/2, testVar=testValue}\] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: Example The previous logging context example affects any output of a **Logger** component and any internal logging that Mule runtime engine produces. ## Create a Set Logging Variable Mule App In the following example, you configure the **Set logging variable** operation to log variables based on the request payload and attributes: ![Set logging variable flow in Studio canvas](/mulesoft/current/en-us/tracing-module/1.0/_images/tracing-module-set-logging-variable-flow.png) 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, set **Path** to `/order`. 4. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP listener in the app. 5. In the **Mule Palette** view, select **Tracing > Set logging variable**. 6. Drag **Set logging variable** to the right of HTTP Listener. 7. Set **Variable name** to `customerId`. 8. Set **Value** to `#[payload.customerId]` to log the customer ID sent in the request. 9. Drag another **Set logging variable** operation to the right of the first **Set logging variable** operation. 10. Set **Variable name** to `requestPath`. 11. Set **Value** to `'#["$(attributes.method):$(attributes.requestPath)"]'` to log the request path. 12. Drag a **Logger** component to the right of the second **Set logging variable** operation. 13. Set **Message** to `#[output application/json --- payload]` to log the request payload. 14. Save and run your Mule app. 15. Send the following curl command: ```xml curl --location --request GET '0.0.0.0:8081/order' \ --header 'Content-Type: application/json' \ --data-raw '{ "orderId": 548102842, "customerId": "ARG-12934", "items": [ "CP-123", "CP-452" ] }' ``` The output logs `customerId`, `requestPath`, and the request payload: ```xml INFO 2021-04-09 11:14:38,409 [[MuleRuntime].uber.05: [tracing-module].tracing-moduleFlow.CPU_LITE @34a62707] [processor: tracing-moduleFlow/processors/2; event: eb2b2461-993d-11eb-8a64-4865ee1fd814] {correlationId=eb2b2461-993d-11eb-8a64-4865ee1fd814, customerId=ARG-12934, processorPath=tracing-moduleFlow/processors/2, requestPath=GET:/order} org.mule.runtime.core.internal.processor.LoggerMessageProcessor: { "orderId": 548102842, "customerId": "ARG-12934", "items": [ "CP-123", "CP-452" ] } ``` ### XML for the Set Logging Variable Mule App Paste this code into your Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [Tracing Module Examples](https://docs.mulesoft.com/tracing-module/1.0/tracing-module-examples) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.1 --- # Configure Tracing Module Logging Variable Operations > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The Tracing module **Clear logging variables**, **Remove logging variable** and **Set logging variable** operations enable you to enhance your logs by adding, removing, and clearing variables from the logging context of a single Mule event. Mapped Diagnostic Context (MDC) enriches logging and improves tracking by providing more context or information in the logs for the current Mule event. By default, Mule logs two MDC entries: `processor`, which shows the location of the current event, and `event`, which shows the correlation ID of the event. ## Before You Begin To use the Tracing module logging operations, complete the following tasks: - Add the module to your Mule project. - Change the pattern layouts in the `log4j.xml` file to `MDC`. ## Add the Module to Your Mule Project Add Tracing module to your Mule project to automatically populate the XML code with the module’s namespace and schema location and to add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `tracing` in the search field. 3. Click **Tracing Module** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. ## Change the Pattern Layouts in the log4j.xml File This change instructs Mule to automatically add the MDC context, which includes the correlation ID and the processor path. To make the change, modify `log4j.xml` in your Mule app or within `/conf/log4j2.xml` in your Mule instance. Follow these steps to change the pattern layouts to MDC: 1. Open the `log4j.xml` file for editing. 2. Replace `[processor: %X{processorPath}; event: %X{correlationId}]` with `[%MDC]`. ### Example log4j.xml File Configurations Example: Default log4j.xml file without MDC logging. Example: Updated log4j.xml file with MDC logging. ## Configure Tracing Module Operations in Studio To configure the logging variables operations, add any of the available operations **Clear logging variables**, **Remove logging variable** or **Set logging variables** to your Mule app flow and specify the corresponding attributes. In the following example, you configure the **Set logging variables** operation: 1. In the **Mule Palette** view of Studio, select **Tracing > Set logging variable** 2. Drag **Set logging variable** to your Mule app. 3. Set **Variable name** to `testVar`. 4. Set **Value** to `testValue`. ![A set logging variable operation configuration window](/mulesoft/current/en-us/tracing-module/1.1/_images/tracing-module-set-logging-variable.png) In the Configuration XML editor, the `` configuration looks like this: ```xml ... ... ``` After executing the flow, the output logs are: INFO 2021-04-08 16:58:26,882 \[\[MuleRuntime\].uber.15: \[test-project-app\].exampleFlow.CPU\_LITE @18f679\] \[{correlationId=c85e16c0-98a4-11eb-bc34-cac765a2219b, processorPath=exampleFlow/processors/2, testVar=testValue}\] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: Example The previous logging context example affects any output of a **Logger** component and any internal logging that Mule runtime engine produces. ## Create a Set Logging Variable Mule App In the following example, you configure the **Set logging variable** operation to log variables based on the request payload and attributes: ![A set logging variable flow in Studio canvas](/mulesoft/current/en-us/tracing-module/1.1/_images/tracing-module-set-logging-variable-flow.png) 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, set **Path** to `/order`. 4. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP listener in the app. 5. In the **Mule Palette** view, select **Tracing > Set logging variable**. 6. Drag **Set logging variable** to the right of HTTP Listener. 7. Set **Variable name** to `customerId`. 8. Set **Value** to `#[payload.customerId]` to log the customer ID sent in the request. 9. Drag another **Set logging variable** operation to the right of the first **Set logging variable** operation. 10. Set **Variable name** to `requestPath`. 11. Set **Value** to `'#["$(attributes.method):$(attributes.requestPath)"]'` to log the request path. 12. Drag a **Logger** component to the right of the second **Set logging variable** operation. 13. Set **Message** to `#[output application/json --- payload]` to log the request payload. 14. Save and run your Mule app. 15. Send the following curl command: ```xml curl --location --request GET '0.0.0.0:8081/order' \ --header 'Content-Type: application/json' \ --data-raw '{ "orderId": 548102842, "customerId": "ARG-12934", "items": [ "CP-123", "CP-452" ] }' ``` The output logs `customerId`, `requestPath`, and the request payload: ```xml INFO 2021-04-09 11:14:38,409 [[MuleRuntime].uber.05: [tracing-module].tracing-moduleFlow.CPU_LITE @34a62707] [processor: tracing-moduleFlow/processors/2; event: eb2b2461-993d-11eb-8a64-4865ee1fd814] {correlationId=eb2b2461-993d-11eb-8a64-4865ee1fd814, customerId=ARG-12934, processorPath=tracing-moduleFlow/processors/2, requestPath=GET:/order} org.mule.runtime.core.internal.processor.LoggerMessageProcessor: { "orderId": 548102842, "customerId": "ARG-12934", "items": [ "CP-123", "CP-452" ] } ``` ### XML for the Set Logging Variable Mule App Paste this code into your Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [Tracing Module Examples](https://docs.mulesoft.com/tracing-module/1.1/tracing-module-examples) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.2 --- # Configure Tracing Module Logging Variable Operations > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The Tracing module **Clear logging variables**, **Remove logging variable** and **Set logging variable** operations enable you to enhance your logs by adding, removing, and clearing variables from the logging context of a single Mule event. Mapped Diagnostic Context (MDC) enriches logging and improves tracking by providing more context or information in the logs for the current Mule event. By default, Mule logs two MDC entries: `processor`, which shows the location of the current event, and `event`, which shows the correlation ID of the event. ## Before You Begin To use the Tracing module logging operations, complete the following tasks: - Add the module to your Mule project. - Change the pattern layouts in the `log4j.xml` file to `MDC`. ## Add the Module to Your Mule Project Add Tracing module to your Mule project to automatically populate the XML code with the module’s namespace and schema location and to add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `tracing` in the search field. 3. Click **Tracing Module** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. ## Change the Pattern Layouts in the log4j.xml File This change instructs Mule to automatically add the MDC context, which includes the correlation ID and the processor path. To make the change, modify `log4j.xml` in your Mule app or within `/conf/log4j2.xml` in your Mule instance. Follow these steps to change the pattern layouts to MDC: 1. Open the `log4j.xml` file for editing. 2. Replace `[processor: %X{processorPath}; event: %X{correlationId}]` with `[%MDC]`. ### Example log4j.xml File Configurations Example: Default log4j.xml file without MDC logging. Example: Updated log4j.xml file with MDC logging. ## Configure Tracing Module Operations in Studio To configure the logging variables operations, add any of the available operations **Clear logging variables**, **Remove logging variable** or **Set logging variables** to your Mule app flow and specify the corresponding attributes. In the following example, you configure the **Set logging variables** operation: 1. In the **Mule Palette** view of Studio, select **Tracing > Set logging variable** 2. Drag **Set logging variable** to your Mule app. 3. Set **Variable name** to `testVar`. 4. Set **Value** to `testValue`. ![A set logging variable operation configuration window](/mulesoft/current/en-us/tracing-module/1.2/_images/tracing-module-set-logging-variable.png) In the Configuration XML editor, the `` configuration looks like this: ```xml ... ... ``` After executing the flow, the output logs are: INFO 2021-04-08 16:58:26,882 \[\[MuleRuntime\].uber.15: \[test-project-app\].exampleFlow.CPU\_LITE @18f679\] \[{correlationId=c85e16c0-98a4-11eb-bc34-cac765a2219b, processorPath=exampleFlow/processors/2, testVar=testValue}\] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: Example The previous logging context example affects any output of a **Logger** component and any internal logging that Mule runtime engine produces. ## Create a Set Logging Variable Mule App In the following example, you configure the **Set logging variable** operation to log variables based on the request payload and attributes: ![A set logging variable flow in Studio canvas](/mulesoft/current/en-us/tracing-module/1.2/_images/tracing-module-set-logging-variable-flow.png) 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, set **Path** to `/order`. 4. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP listener in the app. 5. In the **Mule Palette** view, select **Tracing > Set logging variable**. 6. Drag **Set logging variable** to the right of HTTP Listener. 7. Set **Variable name** to `customerId`. 8. Set **Value** to `#[payload.customerId]` to log the customer ID sent in the request. 9. Drag another **Set logging variable** operation to the right of the first **Set logging variable** operation. 10. Set **Variable name** to `requestPath`. 11. Set **Value** to `'#["$(attributes.method):$(attributes.requestPath)"]'` to log the request path. 12. Drag a **Logger** component to the right of the second **Set logging variable** operation. 13. Set **Message** to `#[output application/json --- payload]` to log the request payload. 14. Save and run your Mule app. 15. Send the following curl command: ```xml curl --location --request GET '0.0.0.0:8081/order' \ --header 'Content-Type: application/json' \ --data-raw '{ "orderId": 548102842, "customerId": "ARG-12934", "items": [ "CP-123", "CP-452" ] }' ``` The output logs `customerId`, `requestPath`, and the request payload: ```xml INFO 2021-04-09 11:14:38,409 [[MuleRuntime].uber.05: [tracing-module].tracing-moduleFlow.CPU_LITE @34a62707] [processor: tracing-moduleFlow/processors/2; event: eb2b2461-993d-11eb-8a64-4865ee1fd814] {correlationId=eb2b2461-993d-11eb-8a64-4865ee1fd814, customerId=ARG-12934, processorPath=tracing-moduleFlow/processors/2, requestPath=GET:/order} org.mule.runtime.core.internal.processor.LoggerMessageProcessor: { "orderId": 548102842, "customerId": "ARG-12934", "items": [ "CP-123", "CP-452" ] } ``` ### XML for the Set Logging Variable Mule App Paste this code into your Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [Tracing Module Examples](https://docs.mulesoft.com/tracing-module/1.2/tracing-module-examples) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.3 is-latest-version: true --- # Configure Tracing Module Logging Variable Operations > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The Tracing module **Clear logging variables**, **Remove logging variable** and **Set logging variable** operations enable you to enhance your logs by adding, removing, and clearing variables from the logging context of a single Mule event. Mapped Diagnostic Context (MDC) enriches logging and improves tracking by providing more context or information in the logs for the current Mule event. By default, Mule logs two MDC entries: `processor`, which shows the location of the current event, and `event`, which shows the correlation ID of the event. ## Before You Begin To use the Tracing module logging operations, complete the following tasks: - Add the module to your integration project. See [Add the Module to Your Integration Project](https://docs.mulesoft.com/tracing-module/latest/tracing-module-config-acb#add-module-to-project). - Change the pattern layouts in the `log4j.xml` file to `MDC`. ## Change the Pattern Layouts in the log4j.xml File This change instructs Mule to automatically add the MDC context, which includes the correlation ID and the processor path. In the Explorer view, open `log4j2.xml` in `src/main/resources` of your integration project, or `/conf/log4j2.xml` in your Mule instance. In the editor, replace `[processor: %X{processorPath}; event: %X{correlationId}]` with `[%MDC]`. ### Example log4j.xml File Configurations Example: Default log4j.xml file without MDC logging. Example: Updated log4j.xml file with MDC logging. ## Configure Tracing Module Operations in Anypoint Code Builder To configure the logging variables operations, add any of the available operations **Clear logging variables**, **Remove logging variable** or **Set logging variables** to your Mule app flow and specify the corresponding attributes. In the following example, you configure the **Set logging variables** operation: 1. Click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon, search for `Tracing`, and select **Set logging variable**. 2. On the **General** tab, set **Variable name** to `testVar` and **Value** to `testValue`. ![The Set logging variable operation General tab](/mulesoft/current/en-us/tracing-module/latest/_images/tracing-module-set-logging-variable-acb.png) In the configuration XML file, the `` configuration looks like this: ```xml ... ... ``` After executing the flow, the output logs are: INFO 2021-04-08 16:58:26,882 \[\[MuleRuntime\].uber.15: \[test-project-app\].exampleFlow.CPU\_LITE @18f679\] \[{correlationId=c85e16c0-98a4-11eb-bc34-cac765a2219b, processorPath=exampleFlow/processors/2, testVar=testValue}\] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: Example The previous logging context example affects any output of a **Logger** component and any internal logging that Mule runtime engine produces. ## Create a Set Logging Variable Mule App In the following example, you configure the **Set logging variable** operation to log variables based on the request payload and attributes: ![A set logging variable flow in the Anypoint Code Builder canvas](/mulesoft/current/en-us/tracing-module/latest/_images/tracing-module-set-logging-variable-flow-acb.png) 1. Click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon, search for `Listener`, and select **Listener** from the **HTTP** results. 2. On the **General** tab, set **Path** to `/order`. 3. Add an HTTP Listener configuration (``) for the listener. See [Add a Global Configuration](https://docs.mulesoft.com/tracing-module/latest/tracing-module-config-acb#add-global-config). 4. Click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon after **Listener**, search for `Tracing`, and select **Set logging variable**. 5. On the **General** tab, set **Variable name** to `customerId` and **Value** to `#[payload.customerId]` to log the customer ID sent in the request. 6. Click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon after the first **Set logging variable** operation, search for `Tracing`, and select **Set logging variable** again. 7. On the **General** tab, set **Variable name** to `requestPath` and **Value** to `'#["$(attributes.method):$(attributes.requestPath)"]'` to log the request path. 8. Click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon after the second **Set logging variable** operation, search for `Logger`, and select it. 9. On the **General** tab, set **Message** to `#[output application/json --- payload]` to log the request payload. 10. Run your application in debug mode. 11. Send the following curl command: ```xml curl --location --request GET '0.0.0.0:8081/order' \ --header 'Content-Type: application/json' \ --data-raw '{ "orderId": 548102842, "customerId": "ARG-12934", "items": [ "CP-123", "CP-452" ] }' ``` The output logs `customerId`, `requestPath`, and the request payload: ```xml INFO 2021-04-09 11:14:38,409 [[MuleRuntime].uber.05: [tracing-module].tracing-moduleFlow.CPU_LITE @34a62707] [processor: tracing-moduleFlow/processors/2; event: eb2b2461-993d-11eb-8a64-4865ee1fd814] {correlationId=eb2b2461-993d-11eb-8a64-4865ee1fd814, customerId=ARG-12934, processorPath=tracing-moduleFlow/processors/2, requestPath=GET:/order} org.mule.runtime.core.internal.processor.LoggerMessageProcessor: { "orderId": 548102842, "customerId": "ARG-12934", "items": [ "CP-123", "CP-452" ] } ``` ### XML for the Set Logging Variable Mule App Paste this code into the configuration XML file of your integration project to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [Tracing Module Examples](https://docs.mulesoft.com/tracing-module/latest/tracing-module-examples) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.0 --- # Tracing Module 1.0 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Tracing module enables you to enhance your logs by adding, removing, and clearing all variables from the logging context for a given Mule event. It also enables you to modify the correlation ID during flow execution. For compatibility information and fixed issues, see the Tracing Module Release Notes. ## Before You Begin To use this module, you must be familiar with: - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Studio or Anypoint Code Builder Before creating an app, you must have Anypoint Platform and Anypoint Studio or Anypoint Code Builder. ## Next Step After you complete the prerequisites, you are ready to create your own app and configure the connector using [Anypoint Studio](https://docs.mulesoft.com/tracing-module/1.0/tracing-module-studio-configuration). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.0 --- # Tracing Module 1.0 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Tracing module enables you to enhance your logs by adding, removing, and clearing variables from the logging context for a given Mule event. It also enables you to modify the correlation ID during flow execution. ## Configurations --- ### Default Configuration Default configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

The name for this configuration. Connectors reference the configuration with this name.

x

## Operations ### Clear Logging Variables `` Clears all the logging variables from the event logging context. This operation does not remove the correlation ID nor the current event processor because those variables are managed by Mule runtime engine. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation

### Remove Logging Variables `` Removes a variable from the event logging context. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation.

Variable name

String

Name of the variable to remove.

x

### Set Logging Variables `` Sets a new logging variable and its value. The new variable is present in the next operation execution for the event. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation.

Variable name

String

Name of the variable to log.

x

Value

String

Value to assign to the variable. Accepts DataWeave expressions.

x

## Scopes ### With CorrelationID `` Scope that creates a process where the inner chain modifies the current correlation ID in the event flow. After the process finishes its execution, the correlation ID returns to the previous ID. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the scope

Correlation id

String

Set a custom correlation ID.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

## See Also [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.1 --- # Tracing Module 1.1 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Tracing module enables you to enhance your logs by adding, removing, and clearing all variables from the logging context for a given Mule event. It also enables you to modify the correlation ID during flow execution. For compatibility information and fixed issues, see the Tracing Module Release Notes. ## Before You Begin To use this module, you must be familiar with: - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Studio or Anypoint Code Builder Before creating an app, you must have Anypoint Platform and Anypoint Studio or Anypoint Code Builder. ## Next Step After you complete the prerequisites, you are ready to create your own app and configure the connector using [Anypoint Studio](https://docs.mulesoft.com/tracing-module/1.1/tracing-module-studio-configuration). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.1 --- # Tracing Module 1.1 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Tracing module enables you to enhance your logs by adding, removing, and clearing variables from the logging context for a given Mule event. It also enables you to modify the correlation ID during flow execution. ## Configurations --- ### Default Configuration Default configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

The name for this configuration. Connectors reference the configuration with this name.

x

## Operations ### Clear Logging Variables `` Clears all the logging variables from the event logging context. This operation does not remove the correlation ID nor the current event processor because those variables are managed by Mule runtime engine. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation

### Remove Logging Variables `` Removes a variable from the event logging context. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation.

Variable name

String

Name of the variable to remove.

x

### Set Logging Variables `` Sets a new logging variable and its value. The new variable is present in the next operation execution for the event. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation.

Variable name

String

Name of the variable to log.

x

Value

String

Value to assign to the variable. Accepts DataWeave expressions.

x

## Scopes ### With CorrelationID `` Scope that creates a process where the inner chain modifies the current correlation ID in the event flow. After the process finishes its execution, the correlation ID returns to the previous ID. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the scope

Correlation id

String

Set a custom correlation ID.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

## See Also [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.2 --- # Tracing Module 1.2 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Tracing module enables you to enhance your logs by adding, removing, and clearing all variables from the logging context for a given Mule event. It also enables you to modify the correlation ID during flow execution. For compatibility information and fixed issues, see the Tracing Module Release Notes. ## Before You Begin To use this module, you must be familiar with: - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Studio or Anypoint Code Builder Before creating an app, you must have Anypoint Platform and Anypoint Studio or Anypoint Code Builder. ## Next Step After you complete the prerequisites, you are ready to create your own app and configure the connector using [Anypoint Studio](https://docs.mulesoft.com/tracing-module/1.2/tracing-module-studio-configuration). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.2 --- # Tracing Module 1.2 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Tracing module enables you to enhance your logs by adding, removing, and clearing variables from the logging context for a given Mule event. It also enables you to modify the correlation ID during flow execution. ## Configurations --- ### Default Configuration Default configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

The name for this configuration. Connectors reference the configuration with this name.

x

## Operations ### Clear Logging Variables `` Clears all the logging variables from the event logging context. This operation does not remove the correlation ID nor the current event processor because those variables are managed by Mule runtime engine. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation

### Remove Logging Variables `` Removes a variable from the event logging context. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation.

Variable name

String

Name of the variable to remove.

x

### Set Logging Variables `` Sets a new logging variable and its value. The new variable is present in the next operation execution for the event. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation.

Variable name

String

Name of the variable to log.

x

Value

String

Value to assign to the variable. Accepts DataWeave expressions.

x

## Scopes ### With CorrelationID `` Scope that creates a process where the inner chain modifies the current correlation ID in the event flow. After the process finishes its execution, the correlation ID returns to the previous ID. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the scope

Correlation id

String

Set a custom correlation ID.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

## See Also [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.3 is-latest-version: true --- # Tracing Module 1.3 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Tracing module enables you to enhance your logs by adding, removing, and clearing all variables from the logging context for a given Mule event. It also enables you to modify the correlation ID during flow execution and add custom attributes to a transaction’s root span. For compatibility information and fixed issues, see the Tracing Module Release Notes. ## Before You Begin To use this module, you must be familiar with: - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Code Builder Before creating an app, you must have Anypoint Platform and Anypoint Code Builder. ## Next Step After you complete the prerequisites, you are ready to create your own app and configure the connector using [Anypoint Code Builder](https://docs.mulesoft.com/tracing-module/latest/tracing-module-config-acb). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.3 is-latest-version: true --- # Tracing Module 1.3 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Tracing module enables you to enhance your logs by adding, removing, and clearing variables from the logging context for a given Mule event. It also enables you to modify the correlation ID during flow execution. ## Configurations --- ### Default Configuration Default configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

The name for this configuration. Connectors reference the configuration with this name.

x

## Operations ### Clear Logging Variables `` Clears all the logging variables from the event logging context. This operation does not remove the correlation ID nor the current event processor because those variables are managed by Mule runtime engine. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation

### Remove Logging Variables `` Removes a variable from the event logging context. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation.

Variable name

String

Name of the variable to remove.

x

### Set Logging Variables `` Sets a new logging variable and its value. The new variable is present in the next operation execution for the event. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation.

Variable name

String

Name of the variable to log.

x

Value

String

Value to assign to the variable. Accepts DataWeave expressions.

x

> [!NOTE] When OpenTelemetry tracing is enabled, the variable set by this operation is also added as > an attribute of the span that represents the operation and of the spans and log records generated > during the rest of the flow’s execution, including subflows, flow references, and error handlers. ### Add Root Span Attributes `` Adds custom attributes to the current transaction’s root (server) span, regardless of how deeply nested the calling flow is. Use this operation to attach transaction-level fields, such as a client ID or conversation ID, to the primary span instead of a child span. > [!NOTE] This operation requires Mule runtime engine 4.13 or later. On earlier runtimes, it is a > no-op. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the operation.

Attributes

Object

Key-value pairs to add as attributes on the root span. Accepts DataWeave expressions.

#[payload]

## Scopes ### With CorrelationID `` Scope that runs the inner chain with the given correlation ID. After the inner chain finishes executing, the correlation ID returns to the previous one. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Display name for the scope

Correlation id

String

Set a custom correlation ID.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

## See Also - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.0 --- # Tracing Module Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To fully benefit from using Tracing module, see the following examples of configuring the module operations and scope: - [Change the Correlation ID During Flow Execution](https://docs.mulesoft.com/tracing-module/1.0/tracing-module-with-correlationid) Configure the **With CorrelationID** scope to modify the correlation ID during flow execution. - [Configure Logging Variables](https://docs.mulesoft.com/tracing-module/1.0/tracing-module-logging) Configure the **Clear logging variables**, **Remove logging variable** and **Set logging variable** Tracing module operations. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.1 --- # Tracing Module Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To fully benefit from using Tracing module, see the following examples of configuring the module operations and scope: - [Change the Correlation ID During Flow Execution](https://docs.mulesoft.com/tracing-module/1.1/tracing-module-with-correlationid) Configure the **With CorrelationID** scope to modify the correlation ID during flow execution. - [Configure Logging Variables](https://docs.mulesoft.com/tracing-module/1.1/tracing-module-logging) Configure the **Clear logging variables**, **Remove logging variable** and **Set logging variable** Tracing module operations. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.2 --- # Tracing Module Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To fully benefit from using Tracing module, see the following examples of configuring the module operations and scope: - [Change the Correlation ID During Flow Execution](https://docs.mulesoft.com/tracing-module/1.2/tracing-module-with-correlationid) Configure the **With CorrelationID** scope to modify the correlation ID during flow execution. - [Configure Logging Variables](https://docs.mulesoft.com/tracing-module/1.2/tracing-module-logging) Configure the **Clear logging variables**, **Remove logging variable** and **Set logging variable** Tracing module operations. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.3 is-latest-version: true --- # Tracing Module Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To fully benefit from using Tracing module, see the following examples of configuring the module operations and scope. The examples use Anypoint Code Builder; see [Using Anypoint Code Builder to Configure Tracing Module](https://docs.mulesoft.com/tracing-module/latest/tracing-module-config-acb) to get started. - [Change the Correlation ID During Flow Execution](https://docs.mulesoft.com/tracing-module/latest/tracing-module-with-correlationid) Configure the **With CorrelationID** scope to modify the correlation ID during flow execution. - [Configure Logging Variables](https://docs.mulesoft.com/tracing-module/latest/tracing-module-logging) Configure the **Clear logging variables**, **Remove logging variable** and **Set logging variable** Tracing module operations. - [Add Custom Attributes to the Root Span](https://docs.mulesoft.com/tracing-module/latest/tracing-module-add-root-span-attributes) Configure the **Add Root Span Attributes** operation to attach transaction-level fields to the root span. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.0 --- # Tracing Module XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio: If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can access the connector from your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. If you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location and it also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/tracing http://www.mulesoft.org/schema/mule/tracing/current/mule-tracing.xsd ``` This example shows how the namespace statements are placed in the `` XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. If you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.modules mule-tracing-module x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `tracing module`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## Next Step After completing your namespace and `pom.xml` file, you can try the [examples](https://docs.mulesoft.com/tracing-module/1.0/tracing-module-examples). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.1 --- # Tracing Module XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio: If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can access the connector from your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. If you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location and it also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/tracing http://www.mulesoft.org/schema/mule/tracing/current/mule-tracing.xsd ``` This example shows how the namespace statements are placed in the `` XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. If you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.modules mule-tracing-module x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `tracing module`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## Next Step After completing your namespace and `pom.xml` file, you can try the [examples](https://docs.mulesoft.com/tracing-module/1.1/tracing-module-examples). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.2 --- # Tracing Module XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio: If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can access the connector from your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. If you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location and it also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/tracing http://www.mulesoft.org/schema/mule/tracing/current/mule-tracing.xsd ``` This example shows how the namespace statements are placed in the `` XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. If you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.modules mule-tracing-module x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `tracing module`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## Next Step After completing your namespace and `pom.xml` file, you can try the [examples](https://docs.mulesoft.com/tracing-module/1.2/tracing-module-examples). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.3 is-latest-version: true --- # Tracing Module XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Code Builder: If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Code Builder XML editor or from a text editor, you can access the connector from your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. If you add the connector in Anypoint Code Builder, Anypoint Code Builder automatically populates the XML code with the connector’s namespace and schema location and it also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/tracing http://www.mulesoft.org/schema/mule/tracing/current/mule-tracing.xsd ``` This example shows how the namespace statements are placed in the `` XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Code Builder contains dependencies for a Mule app. If you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.modules mule-tracing-module x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `tracing module`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## Next Step After completing your namespace and `pom.xml` file, you can try the [examples](https://docs.mulesoft.com/tracing-module/latest/tracing-module-examples). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.3 is-latest-version: true --- # Using Anypoint Code Builder to Configure Tracing Module 1.3 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Code Builder (ACB) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a module in Anypoint Code Builder: 1. [Create an integration project](#create-integration-project). 2. [Add the module to your integration project](#add-module-to-project). 3. [Configure a source for the module’s flow](#configure-source). 4. [Add a module operation or scope to the flow](#add-module-operation). When you run the module, you can view the app log to check for problems, as described in [View the App Log](#view-app-log). If, after reading this topic, you need additional information about the module fields, see the [Tracing Module Reference](https://docs.mulesoft.com/tracing-module/latest/tracing-module-reference). ## Before You Begin Before creating an integration project, you must: - [Set up and access the Anypoint Code Builder web or desktop IDE](https://docs.mulesoft.com/anypoint-code-builder/start-acb) - Have Anypoint Platform credentials ## Create a New Integration Project To create a new integration project: 1. In the activity bar of the IDE, click the ![Anypoint Code Builder icon](/mulesoft/current/en-us/connectors/_images/acb-icon-ms-logo.png) (**Anypoint Code Builder**) icon. 2. From **Quick Actions**, click **Develop an Integration**: ![Develop an Integration link highlighted in the Getting started section](/mulesoft/current/en-us/anypoint-code-builder/_images/develop-integration-option-mat.png) 3. Complete the following in the **Develop an Integration** form:
AttributeValue

Project Name

Unique name for your project.

This name is used as the title and name of the integration project file. For example, if the project name is "Salesforce Integration," the project file name is salesforce-integration.

Project Location

Your home directory or another directory you create. Click Browse to select a different directory for the integration project.

Don’t create the project within another project directory.

4. Select the type of project to create by selecting either the **Empty Project** or **Template or Example** card. 5. Select the **Mule runtime** and **Java Version** for your app. 6. Click **Create Project**. ## Add the Module to Your Integration Project Add Tracing module to your integration project to automatically populate the configuration XML file with the module’s namespace and schema location and to add the required dependency to the project’s `pom.xml` file: 1. In the Explorer view, open the configuration XML file for your project, such as `my-project-name.xml`. 2. Click the ![Show Mule graphical mode icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-tree-view.png) (**Show Mule graphical mode**) icon in the activity bar to open the canvas UI if it doesn’t open automatically. 3. In the canvas UI, click the ![Add component icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon. 4. In the **Add Component** panel, click the ![Search in Exchange icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-search-exchange.png) (**Search in Exchange**) toggle and search for `tracing`. 5. Click **Tracing Module** and then click the operation or scope to add. Adding a module to an integration project does not make that module available to other projects in your Anypoint Code Builder workspace. ## Configure a Source for the Flow A trigger (source) starts the flow when specified conditions are met. If a connector has its own associated sources, you can use a connector-specific trigger to initiate the flow. Each connector trigger has a unique configuration. You can configure the following sources for this connector: - **HTTP > Listener** Initiates a flow each time it receives a request on the configured host and port - **Scheduler** Initiates a flow when a time-based condition is met For example, to configure an HTTP Listener trigger, follow these steps: 1. Click the **Listener** component on the canvas UI. 2. (Optional) Click the edit icon to change the name of the **Listener** component. 3. (Optional) If you created a configuration file for the connector, select it. 4. In the **General** tab, in the **Path** field, enter the relative path for the path set in the HTTP configuration element. See [Configure Paths](https://docs.mulesoft.com/http-connector/latest/http-listener-ref#configure-paths). 5. Select the **Advanced** tab to configure the following attributes:
AttributeDescriptionRequired

Allowed methods

To allow all HTTP methods (default), do not define this attribute. To restrict certain methods, specify all allowed HTTP methods, for example, GET, POST, as a comma-separated list.

No

Response streaming mode

Whether to use streaming when the response is sent.

No

Output MIME type

MIME type of the payload that this component outputs.

No

Parameters

Appends a key-value pair for a reader property to the value of the Output MIME attribute. Multiple key-value pairs are allowed.

No

Output encoding

Encoding of the payload that this component outputs.

No

Streaming Strategy

Configures the way data streams are consumed in Mule apps.

No

Primary node only

Select this option to execute the Listener trigger on the primary node only when running in a cluster.

No

Redelivery policy

Configures the redelivery policy for executing requests that generate errors. You can add a redelivery policy to any source in a flow.

No

Reconnection strategy

When an operation in a Mule application fails to connect to an external server, the default behavior is for the operation to fail immediately and return a connectivity error. You can modify the default behavior by configuring the reconnection strategy for the operation.

No

Response

See HTTP Response Attributes.

No

Error Response

HTTP error response returns a status code for the error.

No

Body

Body of the error message.

No

Headers

Headers to include in the error message.

No

Status code

Status code of the error response, for example, 500.

No

Reason phrase

Reason for the error, for example, Gateway Timeout or Internal Server Error.

No

## Add a Global Configuration Add another component, this time using the XML configuration menu. For example, add the `` component from a snippet. For more information about snippets, see [Configuring Components](https://docs.mulesoft.com/anypoint-code-builder/int-configure-components). 1. In the configuration XML, place your cursor before the `` element and type `http`. Ensure that the cursor is not inside the `` element. 2. Type `http`, and select the `http:listener-config` snippet: ![http:listener-config snippet highlighted in the configuration XML menu](/mulesoft/current/en-us/anypoint-code-builder/_images/add-http-config-snippet.png) The snippet adds the following code: ```xml ``` ## Add a Module Operation or Scope to the Flow When you add a module operation or scope to your flow, you immediately define a specific operation for that module to perform. ![The Add Component panel showing Tracing module operations and scopes in Anypoint Code Builder](/mulesoft/current/en-us/tracing-module/latest/_images/tracing-module-operations-acb.png) After you add components to your integration project, configure the attributes in the component UI, or configure the attributes directly in the XML code editor. Connector XML tags start with a namespace followed by an operation, following the syntax `namespace:operation`, such as `` for a **Select** operation in Anypoint Connector for Database (Database Connector). You can use autocomplete from an expression (**fx**) field for a component to select DataWeave functions from the Core module and other values accepted in this field. ## Run Your Application 1. Open the Run and Debug panel. Show me how - Click the ![](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-run-debug.png) (**Run and Debug**) icon in the activity bar. - Use the keyboard shortcuts: - Mac: Cmd+Shift+d - Windows: Ctrl+Shift+d - Select **View** > **Run**. 2. Click the ![](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-start-debug.png) (**Start Debugging (F5)**) icon for **Debug Mule Application**. Alternatively, if the **Start Debugging (F5)** icon is not present: 1. Click **Run and Debug**. 2. If a **Select debugger** dropdown menu appears, select **Mule Xml Debugger** to initiate the debugging session: ![Run and Debug button and Mule XML Debugger menu item](/mulesoft/current/en-us/anypoint-code-builder/_images/run-debug-imported-folder.png) When the application deploys successfully, you see a `DEPLOYED` log message in the output panel: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \* - - + DOMAIN + - - \* - - + STATUS + - - \* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \* default \* DEPLOYED \* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ## View the App Log To check for problems, you can view the app log in the Output panel of Anypoint Code Builder. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Anypoint Code Builder Overview](https://docs.mulesoft.com/anypoint-code-builder/) - [Creating Integrations](https://docs.mulesoft.com/anypoint-code-builder/int-create-integrations) - [Using Anypoint Code Builder to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-acb) - [Anypoint Code Builder Components and Commands Reference](https://docs.mulesoft.com/anypoint-code-builder/acb-reference) - [Defining and Securing Properties for a Mule Application](https://docs.mulesoft.com/anypoint-code-builder/int-create-secure-configs) - [Triggering Flows in Your Development Environment](https://docs.mulesoft.com/anypoint-code-builder/int-trigger-flows) - [Configuring Components](https://docs.mulesoft.com/anypoint-code-builder/int-configure-components) - [Debugging Mule Applications](https://docs.mulesoft.com/anypoint-code-builder/int-debug-mule-apps) - [Salesforce Help](https://help.salesforce.com) - [Tracing Module Reference](https://docs.mulesoft.com/tracing-module/latest/tracing-module-reference) --- product: Tracing Module version: 1.0 --- # Using Anypoint Studio to Configure Tracing Module 1.0 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). When you run the connector, you can view the app log to check for problems, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, see the [Tracing Module Reference](https://docs.mulesoft.com/tracing-module/1.0/tracing-module-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Module to Your Mule Project Add Tracing module to your Mule project to automatically populate the XML code with the module’s namespace and schema location and to add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `tracing` in the search field. 3. Click **Tracing Module** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a module to a Mule project in Studio does not make that module available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these input sources to use with Tracing module: - **HTTP > Listener** Initiates a flow each time it receives a request on the configured host and port - **Scheduler** Initiates a flow when a time-based condition is met For example, to configure an HTTP listener, follow these steps: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP listener in the app. 6. On the **General** tab, specify the connection information for the listener. 7. On the **TLS** tab, optionally specify the TLS information for the listener. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. ## Add a Module Operation or Scope to the Flow When you add a module operation or scope to your flow, you immediately define a specific operation for that module to perform. To add an operation or scope for Tracing module, follow these steps: 1. In the **Mule Palette** view, select **Tracing** and then select the desired operation or scope. 2. Drag the operation or scope onto the Studio canvas and to the right of the input source. ![Select any Tracing module operation or scope from the Mule Palette view on the right side of Anypoint Studio](/mulesoft/current/en-us/tracing-module/1.0/_images/tracing-module-operations.png) ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [Tracing Module Reference](https://docs.mulesoft.com/tracing-module/1.0/tracing-module-reference) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.1 --- # Using Anypoint Studio to Configure Tracing Module 1.1 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). When you run the connector, you can view the app log to check for problems, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, see the [Tracing Module Reference](https://docs.mulesoft.com/tracing-module/1.1/tracing-module-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Module to Your Mule Project Add Tracing module to your Mule project to automatically populate the XML code with the module’s namespace and schema location and to add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `tracing` in the search field. 3. Click **Tracing Module** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a module to a Mule project in Studio does not make that module available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these input sources to use with Tracing module: - **HTTP > Listener** Initiates a flow each time it receives a request on the configured host and port - **Scheduler** Initiates a flow when a time-based condition is met For example, to configure an HTTP listener, follow these steps: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP listener in the app. 6. On the **General** tab, specify the connection information for the listener. 7. On the **TLS** tab, optionally specify the TLS information for the listener. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. ## Add a Module Operation or Scope to the Flow When you add a module operation or scope to your flow, you immediately define a specific operation for that module to perform. To add an operation or scope for Tracing module, follow these steps: 1. In the **Mule Palette** view, select **Tracing** and then select the desired operation or scope. 2. Drag the operation or scope onto the Studio canvas and to the right of the input source. ![A Mule Palette including Tracing module operation and scope in Anypoint Studio](/mulesoft/current/en-us/tracing-module/1.1/_images/tracing-module-operations.png) ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [Tracing Module Reference](https://docs.mulesoft.com/tracing-module/1.1/tracing-module-reference) - [Salesforce Help](https://help.salesforce.com) --- product: Tracing Module version: 1.2 --- # Using Anypoint Studio to Configure Tracing Module 1.2 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). When you run the connector, you can view the app log to check for problems, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, see the [Tracing Module Reference](https://docs.mulesoft.com/tracing-module/1.2/tracing-module-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Module to Your Mule Project Add Tracing module to your Mule project to automatically populate the XML code with the module’s namespace and schema location and to add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `tracing` in the search field. 3. Click **Tracing Module** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a module to a Mule project in Studio does not make that module available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these input sources to use with Tracing module: - **HTTP > Listener** Initiates a flow each time it receives a request on the configured host and port - **Scheduler** Initiates a flow when a time-based condition is met For example, to configure an HTTP listener, follow these steps: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP listener in the app. 6. On the **General** tab, specify the connection information for the listener. 7. On the **TLS** tab, optionally specify the TLS information for the listener. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. ## Add a Module Operation or Scope to the Flow When you add a module operation or scope to your flow, you immediately define a specific operation for that module to perform. To add an operation or scope for Tracing module, follow these steps: 1. In the **Mule Palette** view, select **Tracing** and then select the desired operation or scope. 2. Drag the operation or scope onto the Studio canvas and to the right of the input source. ![A Mule Palette including Tracing module operation and scope in Anypoint Studio](/mulesoft/current/en-us/tracing-module/1.2/_images/tracing-module-operations.png) ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [Tracing Module Reference](https://docs.mulesoft.com/tracing-module/1.2/tracing-module-reference) - [Salesforce Help](https://help.salesforce.com)