Satyam Pisal
Satyam Pisal

Reputation: 126

Log request event during debug in Mule 4

I want to log an outbound request event (whether it be to http, smb or lambda) before sending it, in debug mode in Anypoint Studio. Is that possible? If yes, how to do it?

Upvotes: 0

Views: 3224

Answers (2)

aled
aled

Reputation: 25782

For the Mule HTTP connector, and other connectors that use the Mule HTTP service, you can enable HTTP wire logging as you mentioned in your answer, by configuring a log4j2 logger in the log4j2.xml file of the application, or in the logging tab in Runtime Manager. Each Mule version has a specific logger. Please take a look at the KB article How to Enable HTTP Wire Logging for detailed instructions.

Specifically for Mule 4.x applications:

<Loggers>
    ...
    <AsyncLogger name="org.mule.service.http.impl.service.HttpMessageLogger" level="DEBUG" />
    ...
</Loggers>

For other connectors you will need to check the documentation of said connectors. I'm not sure if you actually intend to debug the protocol of each connector (for example SMB requests) or just want to see if the connector is doing anything. If the former, most connector doesn't provide the same level of protocol detail as the HTTP connector. You might find it more useful to do a traffic capture and use a packet analyzer like Wireshark for that. For the later, it will depend on each connector what they can print with a logger. This KB article provides instructions for some other connectors.

Upvotes: 1

Satyam Pisal
Satyam Pisal

Reputation: 126

Adding async logger declaration in log4j2.xml can help in this condition. For example, I used

<Loggers>
    ...
    <AsyncLogger name="org.mule.service.http.impl.service.HttpMessageLogger" level="DEBUG" />
    ...
</Loggers>

and it helped me for Http and aws-lambda connectors.

Upvotes: 0

Related Questions