title: How to capture curl trace output into a log file
body: <p>I have the below shell script which execute a curl command with trace. I am able to capture the output(api response) of curl command into the log file, but unable to capture the trace logs into the log file. Please help.</p>
  
  <pre><code>#! /bin/bash
  
  app_header="app_header:test_app"
  cmd="curl -ivk —trace GET https://app.corp.com/api/state/1231231?id=21"
  echo $cmd &gt;&gt; /log/call_app_service.log
  
  for i in {1..2}
  do
      echo "Running $i times" &gt;&gt; /log/call_app_service.log
      $cmd -H $app_header &gt;&gt; /log/call_app_service.log
      echo "\n" &gt;&gt; /log/call_app_service.log
      sleep 1
  done
  </code></pre>