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
This has the value
If
Log files are always UTF-8 encoded. The encoding can not be
changed by setting the option
Notice that the standard handler does not have support for
circular logging. Use the disk_log handler,
The value is set when the handler is added, and it can not be changed in runtime.
Defaults to
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 => #{type => {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 => #{type => {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.