Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mule http request logging

Tags:

mule

I'm sending a https request to a third party api and getting back a response of 403. How do I log to the console the request? I want to verify what I'm sending since it works when I curl it. Using Mule 3.7.0

<flow name="EmailFlow" >
   <jms:inbound-endpoint queue="outbound.queue" doc:name="email outbound communicationQ" connector-ref="Active_MQ" >
   </jms:inbound-endpoint>
   <json:object-to-json-transformer doc:name="Object to JSON"/>

   <logger message="msg is: #[payload]" level="INFO" doc:name="Logger"/>

  <http:request config-ref="https_request_config" path="/api/v1/transmissions" method="POST" doc:name="HTTP">
     <http:request-builder>
     <http:header headerName="Authorization" value="somekey"/>
     <http:header headerName="Content-Type" value="application/json"/>
     </http:request-builder>
     <http:success-status-code-validator values="403"/>
  </http:request>

  <logger level="INFO" doc:name="Logger"/>
</flow>
like image 207
techRunner Avatar asked Dec 06 '22 17:12

techRunner


1 Answers

In 3.7 + You can add the following to your log4j2.xml which performs HTTP wire logging:

<AsyncLogger name="org.mule.module.http.internal.HttpMessageLogger" level="DEBUG" />
<AsyncLogger name="com.ning.http" level="DEBUG" />
like image 188
Ryan Carter Avatar answered Apr 29 '23 03:04

Ryan Carter