aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/logger_std_h.erl
AgeCommit message (Collapse)Author
2019-03-08[logger] Add option file_check to logger_std_hSiri Hansen
OTP-15663 This option indicates how often the handler shall check if the log file still exists and if the inode is changed.
2019-03-08[logger] Add log file rotation by options to logger_std_hSiri Hansen
OTP-15479 OTP-15662 New configuration map for logger_std_h: #{type => file, file => file:filename(), modes => [file:mode()], max_no_bytes => pos_integer() | infinity, max_no_files => non_neg_integer(), compress_on_rotate => boolean()} For backwards compatibility, the old variant for specifying the file name via the 'type' parameter is still supported, i.e. {file,FileName} and {file,FileName,Modes}, but it is no longer documented. Rotation scheme: The current log file always has the same name, and the archived files get extensions ".0", ".1", ... The newest archive has extension ".0", and the oldest archive has the highest number. If 'compress_on_rotate' is set to true, the archived files are gzipped and get the additional extension ".gz", e.g. error.log.0.gz. Rotation is turned off by setting 'max_no_bytes' to infinity. Setting 'max_no_files' to 0 does not turn off rotation, but only specifies that no archives are to be saved.
2019-03-06[logger] Add better control of file modes in logger_std_hSiri Hansen
OTP-15602 It is allowed to set file modes for the handler to use when opening its log file. The given modes were earlier accepted without any checks, which could make the handler behave unexpectedly. This commit makes sure that * if none of write, append or exclusive is given, then append is added * if raw is not given, it is added * if delayed_write or {delayed_write,_,_} is not given, then delayed_write is added
2019-02-22[logger] Refactor logger_std_hSiri Hansen
2019-02-21[logger] Make sure log file is re-opened with configured file optionsSiri Hansen
Earlier, if the log file had to be re-opened, e.g. due to it being renamed or removed, it would always be opened with the default file options, even if other options were set in the configuration. Now, the configured options are used, except that 'append' is always added and 'exclusive' is always removed.
2019-02-13[logger] Keep track of inode for logger_std_h log fileSiri Hansen
If the inode changes, the file is now reopened. This may happen, for instance, if the log file is opened and saved by an editor.
2019-01-16[logger] Remove info and reset functions from handler modulesSiri Hansen
These are not documented, and only used in test. The test now uses logger_olp directly instead.
2019-01-16[logger] Move out overload protection macros from logger_h_common.hrlSiri Hansen
The new file logger_olp.hrl is added.
2018-11-30[logger] Re-create log file if deletedSiri Hansen
This is an update to logger_std_h, which makes it play well with tools like logrotate.
2018-10-19[logger] Further refactor built-in handlersSiri Hansen
2018-10-19[logger] Move common handler code to logger_h_commonSiri Hansen
There was a lot of duplicated code in logger_std_h and logger_disk_log_h. Most of this is now moved to logger_h_common, which now also serves as the gen_server callback.
2018-10-03[logger] Add handler callback filter_config/1Siri Hansen
This function is called when a logger API function for fetching handler configuration is called. The point is to allow the handler to remove internal data fields that it might have stored in the configuration database, before returning the handler configuration to the caller. An example of such internal data are the 'handler_pid' and 'mode_tab' fields that logger_std_h and logger_disk_log_h store in their configuration maps.
2018-10-03[logger] Start using handler callback changing_config/3 in built-in handlersSiri Hansen
The new parameter to this function, SetOrUpdate, indicates how unspecified configuration data fields shall be set. The rule is that if SetOrUpdate equals set, then default values shall be used, and if SetOrUpdate equals update, then existing configuration values shall be used. Consequently, these examples now apply to logger_std_h and logger_disk_log_h: set_handler_config(default, config, #{sync_mode_qlen => 20}) sets the value of sync_mode_qlen to 20, and resets all other (writable) fields in the config map to their default values. update_handler_config(default, config, #{sync_mode_qlen => 20}) sets the value of sync_mode_qlen to 20, and leaves all other fields in the config map unchanged.
2018-09-14[logger] Read config before terminating handler processSiri Hansen
When a handler process is terminated due to overload, it reads its configuration from the configuration database, so it can be restarted with the same configuration after a small delay. This was earlier done in a different process, which was spawned off from the terminate function. This caused a race condition, where in some cases, the configuration was already removed before it could be read. The reason for spawning off a process, is to avoid a deadlock due to the call to logger:remove_handler/1. This commit moves the call to logger:get_handler_config/1 back to the handler process - to ensure that the data is still there, but keeps the call to logger:remove_handler/1 in the spawned off process - to avoid deadlock.
2018-09-12[logger] Fix spec for handler callbacks to always return okSiri Hansen
2018-09-12[logger] Refactor some logger internalsSiri Hansen
2018-07-13[kernel] Reduce risk of dead lock when terminating logger_supSiri Hansen
2018-06-18Update copyright yearHenrik Nord
2018-06-15Merge branch 'siri/logger-fix'Siri Hansen
* siri/logger-fix: [logger] Update documentation [logger] Adjust priority settings in test [logger] Unregister handler names before terminating [logger] Stress overload_kill tests in disk_log handler
2018-06-15[logger] Unregister handler names before terminatingSiri Hansen
2018-06-13[logger] Change name of function sync/1 to filesync/1Peter Andersson
2018-06-11[logger] Move the disk log options to the handler config mapPeter Andersson
Conflicts: lib/kernel/src/logger_disk_log_h.erl
2018-06-11[logger] Removed unused code in logger_std_h and logger_disk_log_hSiri Hansen
2018-06-11[logger] Split config() in two: primary_config() and handler_config()Siri Hansen
2018-06-11[logger] Change names of overload config parameters in build-in handlersPeter Andersson
2018-06-11[logger] Implement logging of handler overload statusPeter Andersson
Conflicts: lib/kernel/src/logger_disk_log_h.erl lib/kernel/src/logger_std_h.erl
2018-06-08[logger] Change name of handler specific config field from ?MODULE to 'config'Siri Hansen
And add field 'module' in handler config.
2018-06-08[logger] Change registered name of built-in handlers and use TID for mode tablePeter Andersson
2018-06-08[logger] Change names of sync functions in built-in handlersSiri Hansen
logger_std_h:filesync/1 -----> logger_std_h:sync/1 logger_disk_log_h:disk_log_sync/1 -----> logger_disk_log_h:sync/1
2018-05-23Change type name logger:log() to logger:log_event()Siri Hansen
2018-05-23Remove HandlerId from handler callback functions and add it to ConfigSiri Hansen
2018-05-21Merge remote-tracking branch 'peppe/peppe/kernel/logger_handler_fixes'Siri Hansen
* peppe/peppe/kernel/logger_handler_fixes: Various logger handler improvements and updated test cases Make it possible to disable sync and drop mode Conflicts: lib/kernel/test/logger_disk_log_h_SUITE.erl lib/kernel/test/logger_std_h_SUITE.erl
2018-05-07Change logger callback removing_handler/1 to removing_handler/2Siri Hansen
2018-05-04Various logger handler improvements and updated test casesPeter Andersson
2018-04-26Add loggerSiri Hansen