diff options
author | Lukas Larsson <[email protected]> | 2018-05-14 11:39:58 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2018-05-21 17:43:52 +0200 |
commit | 3ff770804a27da9add51178b99946ea93d74bd32 (patch) | |
tree | 9ceae2ef157b2792255df89467fe06bcdc4fb9d8 /lib/kernel/test/logger_env_var_SUITE.erl | |
parent | 395dbad6bcc38c3384840674f40657273b05b14a (diff) | |
download | otp-3ff770804a27da9add51178b99946ea93d74bd32.tar.gz otp-3ff770804a27da9add51178b99946ea93d74bd32.tar.bz2 otp-3ff770804a27da9add51178b99946ea93d74bd32.zip |
kernel: Make all handler callbacks not block logger
Diffstat (limited to 'lib/kernel/test/logger_env_var_SUITE.erl')
-rw-r--r-- | lib/kernel/test/logger_env_var_SUITE.erl | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/kernel/test/logger_env_var_SUITE.erl b/lib/kernel/test/logger_env_var_SUITE.erl index e976a10b21..764f443634 100644 --- a/lib/kernel/test/logger_env_var_SUITE.erl +++ b/lib/kernel/test/logger_env_var_SUITE.erl @@ -58,7 +58,8 @@ groups() -> logger_disk_log_formatter, logger_undefined, logger_many_handlers_default_first, - logger_many_handlers_default_last + logger_many_handlers_default_last, + logger_many_handlers_default_last_broken_filter ]}, {bad,[],[bad_error_logger, bad_level, @@ -470,6 +471,8 @@ logger_undefined(Config) -> false = lists:keymember(sasl_h,1,Hs), ok. + +%% Test that we can add multiple handlers with the default first logger_many_handlers_default_first(Config) -> LogErr = file(Config,logger_many_handlers_default_first_error), LogInfo = file(Config,logger_many_handlers_default_first_info), @@ -508,6 +511,28 @@ logger_many_handlers_default_last(Config) -> } ]}], LogErr, LogInfo, 7). +%% Check that we can handle that an added logger has a broken filter +%% This used to cause a deadlock. +logger_many_handlers_default_last_broken_filter(Config) -> + LogErr = file(Config,logger_many_handlers_default_first_broken_filter_error), + LogInfo = file(Config,logger_many_handlers_default_first_broken_filter_info), + + logger_many_handlers( + Config,[{logger, + [{handler,info,logger_std_h, + #{level=>info, + filters=>[{broken,{fun logger_filters:level/2,broken_state}}, + {level,{fun logger_filters:level/2,{stop,gteq,error}}}], + logger_std_h=>#{type=>{file,LogInfo}}} + }, + {handler,?STANDARD_HANDLER,logger_std_h, + #{level=>error, + filters=>[], + formatter=>{logger_formatter,#{}}, + logger_std_h=>#{type=>{file,LogErr}}} + } + ]}], LogErr, LogInfo, 7). + logger_many_handlers(Config, Env, LogErr, LogInfo, NumProgress) -> {ok,#{handlers:=Hs},Node} = setup(Config,Env), check_single_log(Node,LogErr, |