This is the default handler for the Logger
application. Multiple instances of this handler can be added to
logger, and each instance will print logs to
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 standard handler, use
This will have the value
This value (in milliseconds) specifies how often the handler will
do a file 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 standard handler:
logger:add_handler(my_standard_h, logger_std_h,
#{level => info,
filter_default => log,
logger_std_h =>
#{type => {file,"./system_info.log"},
filesync_repeat_interval => 1000}}).
In order to configure the default handler (that starts initially with
the kernel application) to log to file instead of
erl -kernel logger '[{handler,default,logger_std_h,
#{ logger_std_h => #{ type => {file,"./log.log"}}}}]'
An example of how to replace the standard handler with a disk_log handler
at startup can be found in the manual of
Write buffered data to disk.