Function Compute captures all output written to STDOUT and STDERR and uploads it to the Logstore you configure. Use log printing to verify logic and debug functions during development.
How it works
Your function writes log output to STDOUT or STDERR.
The Function Compute runtime collects this output and uploads it to your configured Logstore.
Each log entry is tagged with the log topic
functionName, wherefunctionNameis the name of your function.
To find logs for a specific function, search by log topic:
__topic__: "FCLogs:functionName"Log format
Include the request ID in every log entry to simplify troubleshooting. The recommended format is:
$utcdatetime(yyyy-MM-ddTHH:mm:ss.fff) $requestId [$Level] $messageExample log entry:
2023-10-23 15:43:19 1-65362416-68afb557d64a2e283eccebce [info] hello world| Field | Description | Example |
|---|---|---|
$utcdatetime | UTC timestamp in millisecond precision | 2023-10-23 15:43:19 |
$requestId | Unique ID for the function invocation | 1-65362416-68afb557d64a2e283eccebce |
[$Level] | Log severity level | [info] |
$message | Log message content | hello world |
Runtimes that use context.getLogger() apply this format automatically.
Log printing by runtime
For runtime-specific instructions on printing and viewing logs, see:
该文章对您有帮助吗?