This is a handler for Logger that offers circular
(wrapped) logs by using
The default standard handler,
The handler has an overload protection mechanism that will keep the handler
process and the Kernel application alive during a high load of log
requests. How this feature works, and how to modify the configuration,
is described in the
To add a new instance of the disk_log handler, use
The settings for the disk_log log file should be specified with the
key
Parameters in the
Specific configuration for the handler (represented as a sub map)
is specified with the key
This value (in milliseconds) specifies how often the handler will
do a disk_log sync operation in order to make sure that buffered data
gets written to disk. The handler will repeatedly attempt this
operation, but only perform it if something has actually been logged
since the last sync. The default value is
There are a number of other configuration parameters available, that are
to be used for customizing the overload protection behaviour. The same
parameters are used both in the standard handler and the disk_log handler,
and are documented in the
Note that when changing the configuration of the handler in runtime, by
calling
Example of adding a disk_log handler:
logger:add_handler(my_disk_log_h, logger_disk_log_h,
#{level => error,
filter_default => log,
disk_log_opts =>
#{file => "./my_disk_log",
type => wrap,
max_no_files => 4,
max_no_bytes => 10000},
config =>
#{filesync_repeat_interval => 1000}}).
In order to use the disk_log handler instead of the default standard handler when starting an Erlang node, change the Kernel default logger to use disk_log. Example:
erl -kernel logger '[{handler,default,logger_disk_log_h,
#{disk_log_opts => #{file => "./system_disk_log"}}}]'
Write buffered data to disk.