主题
API 访问日志
INF-LOG-01 | 模块
infra| 记录每次接口调用的耗时、结果与调用方,是性能与审计的原始数据。
1. 使用角色与场景
角色:运维、开发者
- 定位某个接口的慢请求
- 按用户统计调用量
2. 接口与权限点
| 方法 | 路径 | 权限点 | 摘要 | 代码行 |
|---|---|---|---|---|
| GET | /infra/api-access-log/get | infra:api-access-log:query | 获得 API 访问日志 | ApiAccessLogController#L41 |
| GET | /infra/api-access-log/page | infra:api-access-log:query | 获得API 访问日志分页 | ApiAccessLogController#L50 |
| GET | /infra/api-access-log/export-excel | infra:api-access-log:export | 导出API 访问日志 Excel | ApiAccessLogController#L58 |
3. 代码定位
| 层 | 位置 |
|---|---|
| Controller | modules/infra/src/main/java/com/pmforge/module/infra/controller/admin/logger/ApiAccessLogController.java#L41 |
| DO | modules/infra/src/main/java/com/pmforge/module/infra/dal/dataobject/logger/ApiAccessLogDO.java |
4. 数据表
| 表 | DO |
|---|---|
infra_api_access_log | ApiAccessLogDO |
5. 机制与配置
- @ApiAccessLog 注解 + 过滤器采集,异步落库
- 可通过配置按 URL 前缀开关
6. 常见问题与排查
- 全量开启会显著增加写库压力,生产建议按需开启
7. 关联
- 需求原件:02-05-监控运维
- 相关卡片:INF-LOG-02
- 相关卡片:SYS-LOG-02