Skip to content

日志环境变量(Logs environment variables)#

File-based configuration

You can add _FILE to individual variables to provide their configuration in a separate file. Refer to Keeping sensitive data in separate files for more details.

本页面列出了用于设置调试日志记录的环境变量。详细信息请参阅 n8n 日志记录

🌐 This page lists environment variables to set up logging for debugging. Refer to Logging in n8n for details.

n8n 日志(n8n logs)#

Variable Type Default Description
N8N_LOG_LEVEL Enum string: info, warn, error, debug info Log output level. Refer to Log levels for details.
N8N_LOG_OUTPUT Enum string: console, file console Where to output logs. Provide multiple values as a comma-separated list.
N8N_LOG_FORMAT Enum string: text, json text The log format to use. text prints human readable messages. json prints one JSON object per line containing the message, level, timestamp, and all metadata. This is useful for production monitoring as well as debugging.
N8N_LOG_CRON_ACTIVE_INTERVAL Number 0 Interval in minutes to log currently active cron jobs. Set to 0 to disable.
N8N_LOG_FILE_COUNT_MAX Number 100 Max number of log files to keep.
N8N_LOG_FILE_SIZE_MAX Number 16 Max size of each log file in MB.
N8N_LOG_FILE_LOCATION String <n8n-directory-path>/logs/n8n.log Log file location. Requires N8N_LOG_OUTPUT set to file.
DB_LOGGING_ENABLED Boolean false Whether to enable database-specific logging.
DB_LOGGING_OPTIONS Enum string: query, error, schema, warn, info, log error Database log output level. To enable all logging, specify all. Refer to TypeORM logging options
DB_LOGGING_MAX_EXECUTION_TIME Number 1000 Maximum execution time (in milliseconds) before n8n logs a warning. Set to 0 to disable long running query warning.
CODE_ENABLE_STDOUT Boolean false Set to true to send Code node logs from console.log or print to the process's stdout, only for production executions.
NO_COLOR any undefined Set to any value to output logs without ANSI colors. For more information, see the no-color.org website.

日志流(Log streaming)#

有关此功能的更多信息,请参阅日志流

🌐 Refer to Log streaming for more information on this feature.

变量 类型 默认值 描述
N8N_EVENTBUS_CHECKUNSENTINTERVAL 数字 0 检查未发送事件消息的频率(以毫秒为单位)。在少数情况下可能会发送两次消息。设置为 0 可禁用此功能。
N8N_EVENTBUS_LOGWRITER_SYNCFILEACCESS 布尔值 false 所有文件访问是否在同一线程中同步进行(true)或不同步(false)。
N8N_EVENTBUS_LOGWRITER_KEEPLOGCOUNT 数字 3 保留的事件日志文件数量。
N8N_EVENTBUS_LOGWRITER_MAXFILESIZEINKB 数字 10240 事件日志文件的最大大小(以千字节为单位),超过该大小将创建新文件。
N8N_EVENTBUS_LOGWRITER_LOGBASENAME 字符串 n8nEventLog 事件日志文件的基本名称。