logger.conf配置

EMQX 客服发表于:2022年03月25日 09:58:09更新于:2022年03月25日 11:21:21

log.to

## Value: file | console | both
## - file: write logs only to file
## - console: write logs only to standard I/O
## - both: write logs both to file and standard I/O
log.to = file

说明:将日志输出到什么地方。可选值为:

  • off: 完全关闭日志功能

  • file: 仅将日志输出到文件

  • console: 仅将日志输出到标准输出(emqx 控制台)

  • both: 同时将日志输出到文件和标准输出(emqx 控制台)

log.level

## Value: debug | info | notice | warning | error | critical | alert | emergency
##
## Note: Only the messages with severity level higher than or equal to
##       this level will be logged.
##
## Default: warning
log.level = warning

说明:全局的日志级别。这包括 primary log level 以及所有的 log handlers。详情请参见 日志级别和 log handlers

lod.dir

## Value: Folder
log.dir = log

说明:日志文件目录。

log.file

## Value: String
## Default: emqx.log
log.file = emqx.log

说明:日志文件的前缀。例如,若使用默认值 (log.file = emqx.log),日志文件名将为 emqx.log.1emqx.log.2,...。

log.chars_limit

## Value: Integer
## Default: No Limit
#log.chars_limit = 8192

说明:设置单个日志消息的最大长度。如超过此长度,日志消息将被截断。-1 表示无限制。

log.max_depth

## Value: Integer or 'unlimited' (without quotes)
## Default: 100
#log.max_depth = 100

log.formatter

## Value: text | json
#log.formatter = text

说明:选择日志打印格式

log.single_line

## Value: Boolean
#log.single_line = true

说明:设置成 true 时,单行打印日志。 如果设置成 false, 如 crash 日志中的堆栈信息等将打印多行

log.rotation

## Value: on | off
## Default: on
log.rotation = on

说明:启用日志滚动(超过单个文件设置大小,则创建新的日志文件)

log.rotation.size

## Value: Number
## Default: 10M
## Supported Unit: KB | MB | GB
log.rotation.size = 10MB

说明:设置单个日志文件大小。如超过此大小,则进行日志文件滚动,创建新的日志文件。

log.rotation.count

## Value: Number
## Default: 5
log.rotation.count = 5

说明:设置日志文件总个数。如超过此文件个数,则下一次日志文件滚动将会覆盖第一个文件。

log.<level>.file

说明:针对某日志级别设置单独的日志文件。

示例:

将 info 及 info 以上的日志单独输出到 info.log.N 文件中:

log.info.file = info.log

将 error 及 error 以上的日志单独输出到 error.log.N 文件中:

log.error.file = error.log

log.drop_mode_qlen

## Log overload protection parameter. When the message queue grows
## larger than this threshold, the handler switches to a mode in which
## it drops all new events that senders want to log.
##
## Default: 3000
##
#log.drop_mode_qlen = 3000

说明:切换到丢弃模式前允许的最大队列长度。

log.flush_qlen

## Log overload protection parameter. If the length of the message queue
## grows larger than this threshold, a flush (delete) operation takes place.
## To flush events, the handler discards the messages in the message queue
## by receiving them in a loop without logging.
##
## Default: 8000
##
#log.flush_qlen = 8000

说明:切换到刷新模式前允许的最大队列长度。

log.overload_kill

## Log overload protection parameter. It is possible that a handler,
## even if it can successfully manage peaks of high load without crashing,
## can build up a large message queue, or use a large amount of memory.
## We could kill the log handler in these cases and restart it after a
## few seconds.
##
## Default: on
##
#log.overload_kill = on

说明:当日志处理程序超载时,将其杀死,并在几秒钟后重新启动它。

log.overload_kill_qlen

## Log overload protection parameter. This is the maximum allowed queue
## length. If the message queue grows larger than this, the handler
## process is terminated.
##
## Default: 20000
##
#log.overload_kill_qlen = 20000

说明:日志过载保护参数。这是允许的最大队列长度。如果消息队列增长大于此值,则处理程序进程终止。

log.overload_kill_mem_size

## The max allowed memory size before killing the log hanlder.
##
## Log overload protection parameter. This is the maximum memory size
## that the handler process is allowed to use. If the handler grows
## larger than this, the process is terminated.
##
## Default: 30MB
##
#log.overload_kill_mem_size = 30MB

说明:终止日志句柄之前允许的最大内存大小。

日志过载保护参数。这是处理程序进程允许使用的最大内存大小。如果处理程序的增长大于此值,则进程终止。

log.overload_kill_restart_after

## Restart the log hanlder after some seconds.
##
## Log overload protection parameter. If the handler is terminated,
## it restarts automatically after a delay specified in seconds.
## The value "infinity" prevents restarts.
##
## Default: 5s
##
#log.overload_kill_restart_after = 5s

说明:日志过载保护参数。如果处理程序终止,它会在以秒为单位指定的延迟后自动重新启动。

log.burst_limit

## Value: MaxBurstCount,TimeWindow
## Default: disabled
##
#log.burst_limit = 20000, 1s

说明:用于突发控制的最大突发计数和时间窗口。

日志过载保护参数。大量日志事件(处理程序在短时间内收到的许多事件)可能会导致问题。通过指定特定时间范围内要处理的最大事件数,处理程序可以避免大量打印输出阻塞日志。

此配置控制一个时间范围内要处理的最大事件数。在达到极限后,连续事件将被丢弃,直到时间范围结束。

请注意,如果由于突发控制而丢弃任何消息,则不会发出警告。


    您需要登录后才可以回复