主要内容

本页采用了机器翻译。点击此处可查看英文原文。

GET Active Log

获取服务器的活动主日志

自 R2026a 起

描述

使用 GET 方法读取服务器的活动日志。活动日志是服务器当前正在写入的主日志。取消注释 main_config 文件中的--log-endpoint 属性以启用 API。

有关启用和使用 API 的详细信息,请参阅使用 API 读取活动日志

请求

HTTP 方法

GET

URI

http://host:port/api/log

响应

成功

HTTP 状态代码

200 OK

主体
日期时间严重性条目
日志中该条目的行号 条目的日期和时间,格式为 YYYY:MM:DD HH:MM:SS

消息的严重程度(informationwarningerrortrace

日志条目本身

示例

1 [2025.03.18 13:50:49.510638] [information] Starting master (pid = 10676)
2 [2025.03.18 13:50:49.511635] [information] Global locale: en_US
3 [2025.03.18 13:50:49.511635] [information] Global encoding: UTF-8
4 [2025.03.18 13:50:49.511635] [information] terminal encoding: UTF-8
11 [2025.03.18 13:50:50.168347] [information] -- log directory: "L:\\server\\test_server\\log"
12 [2025.03.18 13:50:50.169334] [information] configuring WebFunction router
13 [2025.03.18 13:50:50.169334] [information] -- loading routes file: .\config\routes.json
122 [2025.03.18 13:50:51.419418] [information] -- UriPathRegexMatcher: removing old entries. operation=add, component=mps_check, entries=0, exists=false

错误

HTTP 状态代码

403 Log Endpoint Disabled

404 Log Not Found

示例调用

HTTP

请求:

GET /api/health HTTP/1.1
Host: localhost:9910

响应:

HTTP/1.1 200 OK

cURL

curl "http://localhost:9910/api/log"

版本历史记录

在 R2026a 中推出