Skip to contentSkip to navigationSkip to topbar
Rate this page:

Logging and debugging


To help debug issues with commands, the Twilio CLI also supports logging via the -l flag.

You can decide what level of logging you'd like by using the -l option. The valid levels of logging messages are debug, info, warn, error, and none.

All debug, informational, warning, and error logs are sent to stderr. This is so it can be easily separated from the command output.

For example, suppose you're unable to list your messages and aren't sure why:


_10
$ twilio api:core:messages:list
_10
» twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: "https://github.com/twilio/twilio-cli/issues"

In this case (and most cases), debug logs will help you inspect the issue and see errors in greater detail:


_16
$ twilio api:core:messages:list -l debug
_16
[DEBUG] Config File: /Users/example/.twilio-cli/config.json
_16
[DEBUG] Using profile: developer
_16
[DEBUG] Provided flags: {"cli-log-level":"debug","cli-output-format":"columns","silent":false,"skip-parameter-validation":false,"properties":"sid,from,to,status,direction,dateSent","limit":50,"no-limit":false}
_16
[DEBUG] domainName=api, path=/2010-04-01/Accounts/{AccountSid}/Messages.json, actionName=list
_16
[DEBUG] pathNode=AccountSid, value=ACxxxx
_16
[DEBUG] -- BEGIN Twilio API Request --
_16
[DEBUG] get https://api.sydney.jp1.twilio.com/2010-04-01/Accounts/ACxxxx/Messages.json
_16
[DEBUG] Custom HTTP Headers:
_16
[DEBUG] User-Agent: twilio-cli/5.1.0 @twilio/cli-core/7.3.0 (darwin x64) twilio-api-client/7.3.0 api:core:messages:list
_16
[DEBUG] -- END Twilio API Request --
_16
[DEBUG] Found command "api:core:messages:list" plugin: twilio-cli
_16
» twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: "https://github.com/twilio/twilio-cli/issues"
_16
[DEBUG] getaddrinfo ENOTFOUND api.sydney.jp1.twilio.com
_16
[DEBUG] Error: getaddrinfo ENOTFOUND api.sydney.jp1.twilio.com
_16
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26)

Instead of an opaque error message, you now have logs that indicate the issue is due to an invalid URL in the request. Time to verify that you have the correct Edge and Region set for your account!


Rate this page: