fix(logging): harden file level configuration

Make persisted log filtering predictable across supported startup settings while rejecting configurations that could silently retain more data than intended.

Keep the first WebUI login credential available without weakening normal log thresholds, clarify the operator-facing behavior, and strengthen regression coverage across isolated environments and explicit file-output disablement.
This commit is contained in:
DrSmoothl committed 2026-07-30 10:27:43 +08:00
1 parent 227a62f2ad
commit 655226d9d7
6 files changed
+212 -181

No files matched your search

+3 -2
View File
@@ -101,9 +101,10 @@ WebUI 的“系统设置 → 存储管理”可查看受管数据占用、调整
| 日志树总量上限 | 1024 MB | `SNOWLUMA_LOG_MAX_TOTAL_MB` |
| 日志保留天数 | 7 天;`0` 表示关闭按日期清理 | `SNOWLUMA_LOG_RETAIN_DAYS` |
| 按账号额外写日志 | 关闭 | `SNOWLUMA_LOG_PER_UIN` |
| 文件日志级别 | debug | `SNOWLUMA_LOG_FILE_LEVEL` |
环境变量优先于 `config/runtime.json`,对应字段会在 WebUI 中显示为锁定。`SNOWLUMA_LOG_MAX_MB` 仅控制单个日志分卷大小,不是日志树总量上限。
以上环境变量优先于 `config/runtime.json`,对应字段会在 WebUI 中显示为锁定。`SNOWLUMA_LOG_MAX_MB` 仅控制单个日志分卷大小,不是日志树总量上限。
文件日志等级可通过 `SNOWLUMA_LOG_FILE_LEVEL` 单独设置为 `debug`、`info`、`success`、`warn` 或 `error`,默认为 `debug`。该启动参数不写入 `config/runtime.json`,也不受 WebUI 实时日志等级影响;TRACE 始终不落盘。
## 选择接入方式