This is the standard handler for Logger.
Multiple instances of this handler can be added to
Logger, and each instance prints logs to
The handler has an overload protection mechanism that keeps the handler
process and the Kernel application alive during high loads of log
events. How overload protection works, and how to configure it, is
described in the
To add a new instance of the standard handler, use
Specifies the log destination.
The value is set when the handler is added, and it can not be changed in runtime.
Defaults to
This specifies the name of the log file when the handler is
of type
The value is set when the handler is added, and it can not be changed in runtime.
Defaults to the same name as the handler identity, in the current directory.
This specifies the file modes to use when opening the log
file,
see
Log files are always UTF-8 encoded. The encoding can not be
changed by setting the mode
The value is set when the handler is added, and it can not be changed in runtime.
Defaults to
This parameter specifies if the log file should be rotated
or not. The value
Defaults to
This parameter specifies the number of rotated log file
archives to keep. This has meaning only
if
The log archives are
named
Notice that setting this value to
Defaults to
This parameter specifies if the rotated log file archives
shall be compressed or not. If set to
Defaults to
When
In order to allow minimizing the performance loss, the
Notice that the risk of loosing log events grows when
the
Defaults to 0.
This value, in milliseconds, specifies how often the handler does a file sync operation to write buffered data to disk. The handler attempts the operation repeatedly, but only performs a new sync if something has actually been logged.
If
Defaults to
Other configuration parameters exist, 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
Notice that if changing the configuration of the handler in
runtime, the
Example of adding a standard handler:
logger:add_handler(my_standard_h, logger_std_h,
#{config => #{file => "./system_info.log",
filesync_repeat_interval => 1000}}).
To set the default handler, that starts initially with
the Kernel application, to log to file instead of
erl -kernel logger '[{handler,default,logger_std_h,
#{config => #{file => "./log.log"}}}]'
An example of how to replace the standard handler with a disk_log handler
at startup is found in the
Write buffered data to disk.