日志
日志级别、文件、syslog 和控制台颜色
修改这些变量,以调整日志的详细程度、日志文件的位置,或以您自己的时区显示时间戳。
示例
在文件中记录比控制台更多的日志,并以阿姆斯特丹时间显示日志和作业的时间戳。 在 compose 项目的 .env 中:
LOG_LEVEL=info
LOG_CONSOLE_LEVEL=notice
LOG_TZ=Europe/Amsterdam
Syslog
Syslog 服务器不再在这里配置:请在 设置 > 连接 > Syslog 下添加,参见 日志。 下面的 LOG_SYSLOG_* 变量自 7 起已弃用。首次启动时如果发现设置了 LOG_SYSLOG_HOST,会将它们一次性 导入为 syslog 服务器 syslog,用于接收服务器日志,此后便忽略这些变量。
变量
本组的所有变量,包括其类型、默认值和描述:
| 变量 | 可选值/默认值 | 说明 |
|---|---|---|
| LOG_FORMAT string added in version 7.0.0 | 默认值: text | Log format
Every request gets an id: the X-Request-Id a reverse proxy sent, or a new one. It is returned in the response’s X-Request-Id header and carried by every line written while the request is served ( |
| LOG_LEVEL string | 可选值:
| Log level
AnsibleForms logs to a log file called ansibleforms.log. |
| LOG_RETENTION_DAYS number added in version 7.0.0 | 默认值: 90 | Log file retention (days)
How many days of server log files are kept: the main log and the errors log, one file a day, zipped once the day is over. Older files are deleted. 0 keeps every file. Takes effect at once, without a restart. |
| LOG_PATH string | 默认值: %PERSISTENT_FOLDER%/logs | Logs folder
AnsibleForms maintains 2 logfiles. 新增于 4.0.0
Make the logfiles rotating with daily timestamp. 30days of logs are kept. |
| LOG_CONSOLE_LEVEL string | 可选值:
| Console log level
When you run ansibleforms, by default the application also logs to the console. |
| LOG_TZ string added in version 5.0.10 | 默认值: UTC | Log time zone
Sets the timezone for log timestamps. Use a valid IANA timezone string (e.g., UTC, Europe/Amsterdam, America/New_York). Also used for the job timestamps. |
| LOG_SYSLOG_HOST string added in version 3.0.1 | 默认值: | Syslog host (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds |
| LOG_SYSLOG_LEVEL string added in version 3.0.1 | 可选值:
| Syslog level (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds |
| LOG_SYSLOG_PORT number added in version 3.0.1 | 默认值: 514 | Syslog port (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds |
| LOG_SYSLOG_PROTOCOL string added in version 3.0.1 | 可选值:
| Syslog protocol (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds |
| LOG_SYSLOG_PATH string added in version 3.0.1 | 默认值: /dev/log | Syslog path (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds |
| LOG_SYSLOG_SOURCE string added in version 3.0.1 | 默认值: localhost | Syslog source hostname (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds |
| LOG_SYSLOG_TYPE string added in version 3.0.1 | 可选值:
| Syslog protocol type (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds |
| LOG_SYSLOG_APPNAME string added in version 3.0.1 | 默认值: AnsibleForms | Syslog app name (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds |
| LOG_COLOR_ERROR string added in version 3.0.1 | 默认值: \x1b[31m | Error color code
The escape color code for error (default red) |
| LOG_COLOR_WARN string added in version 3.0.1 | 默认值: \x1b[33m | Warning color code
The escape color code for warning (default yellow) |
| LOG_COLOR_NOTICE string added in version 3.0.1 | 默认值: \x1b[37m | Notice color code
The escape color code for notice (default white) |
| LOG_COLOR_INFO string added in version 3.0.1 | 默认值: \x1b[32m | Info color code
The escape color code for info (default green) |
| LOG_COLOR_DEBUG string added in version 3.0.1 | 默认值: \x1b[36m | Debug color code
The escape color code for debug (default cyan) |