All Products
Search
Document Center

:Debug logs

Last Updated:Jun 02, 2026

Enable log output in Alibaba Cloud CLI to view request and response details for troubleshooting.

Note

The log output feature for OSS commands is enabled differently from Alibaba Cloud CLI. For more information, see the "Enable logging for OSS commands" section in this topic.

Enable logging with an environment variable

Set the environment variable DEBUG to sdk to enable log output.

Variable name

Variable value

Remarks

DEBUG

sdk

To disable log output, delete this variable.

For more information about how to configure environment variables, see Configure environment variables in Linux, macOS, and Windows.

Example

Run a command to verify log output:

aliyun ecs DescribeRegions

Sample output:

> POST /?AccessKeyId=<yourAccesskeyId>&Action=DescribeRegions&Format=JSON&RegionId=cn-hangzhou&Signature=u9lPKI5Nyw0dIKV5ytJAx6****&SignatureMethod=HMAC-SHA1&SignatureNonce=29f426485b2720f6ae0****&SignatureType=&SignatureVersion=1.0&Timestamp=2020-05-18T09%3A52%3A42Z&Version=2014-05-26 HTTP/1.1
> Host: ecs-cn-hangzhou.aliyuncs.com
> x-acs-action: DescribeEndpoints
> x-acs-credentials-provider: static_sts
> x-sdk-client: golang/1.0.0
> x-sdk-invoke-type: common
> Accept-Encoding: identity
> x-acs-version: 2014-05-26
> User-Agent: AlibabaCloud (darwin; amd64) Golang/1.13.9 Core/0.0.1 Aliyun-CLI/3.0.43
> x-sdk-core-version: 1.63.22
> Content-Type: application/x-www-form-urlencoded
>
 Retry Times: 0.
< HTTP/1.1 200 OK
< Access-Control-Expose-Headers: *
< X-Acs-Trace-Id: 99176a2d8de06237945913f8e9f66adb
< Content-Type: application/json;charset=utf-8
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< X-Acs-Request-Id: 4C92B935-4698-5EF5-BB0E-EAF1C3F4CE34
< Date: Tue, 17 Jun 2025 02:14:09 GMT
< Keep-Alive: timeout=25
< Vary: Accept-EncodingAccept-Encoding
<
# omitted output

Enable logging for OSS commands

For OSS commands, use the --loglevel option to enable logging and set the log level.

Valid values:

  • Empty (default): no log output.

  • info: informational log.

  • debug: detailed log.

Logs are written to a file. The CLI displays the file path:

aliyun oss ls --loglevel info
log file is /Users/user/Documents/ossutil.log
# omitted output