All Products
Search
Document Center

Alibaba Cloud CLI:Debug logs

Last Updated:Nov 03, 2025

When you use Alibaba Cloud CLI to call an API operation, you can enable the log output feature to display the log of the request. This helps you analyze whether the response content is correct.

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

In the CLI, you can set the environment variable DEBUG to sdk to enable the log output feature.

Variable name

Variable value

Remarks

DEBUG

sdk

To disable the log output feature, delete this environment variable.

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

Example

Run the following command to enable the log output feature:

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

When you use OSS commands, you can use the --loglevel option to enable the log output feature and specify the log level.

Valid values:

  • By default, this option is empty. No log is output.

  • info: informational log.

  • debug: detailed log.

The log is output to a file. The file path is displayed in the CLI. Example:

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