aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/src/error_logger.erl6
-rw-r--r--lib/kernel/src/logger.erl4
-rw-r--r--lib/kernel/src/logger_disk_log_h.erl30
-rw-r--r--lib/kernel/src/logger_server.erl6
-rw-r--r--lib/kernel/src/logger_std_h.erl30
-rw-r--r--lib/kernel/test/logger_SUITE.erl2
-rw-r--r--lib/kernel/test/logger_bench_SUITE.erl2
-rw-r--r--lib/kernel/test/logger_disk_log_h_SUITE.erl100
-rw-r--r--lib/kernel/test/logger_env_var_SUITE.erl30
-rw-r--r--lib/kernel/test/logger_simple_h_SUITE.erl2
-rw-r--r--lib/kernel/test/logger_std_h_SUITE.erl180
11 files changed, 198 insertions, 194 deletions
diff --git a/lib/kernel/src/error_logger.erl b/lib/kernel/src/error_logger.erl
index 4b3922cdd7..3bdd70fa96 100644
--- a/lib/kernel/src/error_logger.erl
+++ b/lib/kernel/src/error_logger.erl
@@ -513,7 +513,7 @@ tty(true) ->
_ = case lists:member(error_logger_tty_h, which_report_handlers()) of
false ->
case logger:get_handler_config(default) of
- {ok,{logger_std_h,#{logger_std_h:=#{type:=standard_io}}}} ->
+ {ok,{logger_std_h,#{config:=#{type:=standard_io}}}} ->
logger:remove_handler_filter(default,
error_logger_tty_false);
_ ->
@@ -523,7 +523,7 @@ tty(true) ->
[otp]),
formatter=>{?DEFAULT_FORMATTER,
?DEFAULT_FORMAT_CONFIG},
- logger_std_h=>#{type=>standard_io}})
+ config=>#{type=>standard_io}})
end;
true ->
ok
@@ -533,7 +533,7 @@ tty(false) ->
delete_report_handler(error_logger_tty_h),
_ = logger:remove_handler(error_logger_tty_true),
_ = case logger:get_handler_config(default) of
- {ok,{logger_std_h,#{logger_std_h:=#{type:=standard_io}}}} ->
+ {ok,{logger_std_h,#{config:=#{type:=standard_io}}}} ->
logger:add_handler_filter(default,error_logger_tty_false,
{fun(_,_) -> stop end, ok});
_ ->
diff --git a/lib/kernel/src/logger.erl b/lib/kernel/src/logger.erl
index b251b21bff..df7ce22e2a 100644
--- a/lib/kernel/src/logger.erl
+++ b/lib/kernel/src/logger.erl
@@ -96,7 +96,9 @@
-type filter_arg() :: term().
-type filter_return() :: stop | ignore | log_event().
-type config() :: #{id => handler_id(),
+ config => map(),
level => level() | all | none,
+ module => module(),
filter_default => log | stop,
filters => [{filter_id(),filter()}],
formatter => {module(),formatter_config()},
@@ -673,7 +675,7 @@ init_default_config(Type) when Type==standard_io;
element(1,Type)==file ->
Env = get_logger_env(),
DefaultFormatter = #{formatter=>{?DEFAULT_FORMATTER,?DEFAULT_FORMAT_CONFIG}},
- DefaultConfig = DefaultFormatter#{logger_std_h=>#{type=>Type}},
+ DefaultConfig = DefaultFormatter#{config=>#{type=>Type}},
NewLoggerEnv =
case lists:keyfind(default, 2, Env) of
{handler, default, Module, Config} ->
diff --git a/lib/kernel/src/logger_disk_log_h.erl b/lib/kernel/src/logger_disk_log_h.erl
index ba90fefcd3..d339957ac8 100644
--- a/lib/kernel/src/logger_disk_log_h.erl
+++ b/lib/kernel/src/logger_disk_log_h.erl
@@ -115,7 +115,7 @@ adding_handler(#{id:=Name}=Config) ->
case check_config(adding, Config) of
{ok, Config1} ->
%% create initial handler state by merging defaults with config
- HConfig = maps:get(?MODULE, Config1, #{}),
+ HConfig = maps:get(config, Config1, #{}),
HState = maps:merge(get_init_state(), HConfig),
case logger_h_common:overload_levels_ok(HState) of
true ->
@@ -139,15 +139,15 @@ adding_handler(#{id:=Name}=Config) ->
%%%-----------------------------------------------------------------
%%% Updating handler config
-changing_config(OldConfig=#{id:=Name, disk_log_opts:=DLOpts, ?MODULE:=HConfig},
+changing_config(OldConfig=#{id:=Name, disk_log_opts:=DLOpts, config:=HConfig},
NewConfig=#{id:=Name, disk_log_opts:=DLOpts}) ->
case check_config(changing, NewConfig) of
- {ok,NewConfig1 = #{?MODULE:=NewHConfig}} ->
+ {ok,NewConfig1 = #{config:=NewHConfig}} ->
#{handler_pid:=HPid,
mode_tab:=ModeTab} = HConfig,
NewHConfig1 = NewHConfig#{handler_pid=>HPid,
mode_tab=>ModeTab},
- NewConfig2 = NewConfig1#{?MODULE=>NewHConfig1},
+ NewConfig2 = NewConfig1#{config=>NewHConfig1},
try gen_server:call(HPid, {change_config,OldConfig,NewConfig2},
?DEFAULT_CALL_TIMEOUT) of
ok -> {ok,NewConfig2};
@@ -167,11 +167,11 @@ check_config(adding, #{id:=Name}=Config) ->
LogOpts = merge_default_logopts(Name, LogOpts0),
case check_log_opts(maps:to_list(LogOpts)) of
ok ->
- MyConfig = maps:get(?MODULE, Config, #{}),
+ MyConfig = maps:get(config, Config, #{}),
case check_my_config(maps:to_list(MyConfig)) of
ok ->
{ok,Config#{disk_log_opts=>LogOpts,
- ?MODULE=>MyConfig}};
+ config=>MyConfig}};
Error ->
Error
end;
@@ -179,7 +179,7 @@ check_config(adding, #{id:=Name}=Config) ->
Error
end;
check_config(changing, Config) ->
- MyConfig = maps:get(?MODULE, Config, #{}),
+ MyConfig = maps:get(config, Config, #{}),
case check_my_config(maps:to_list(MyConfig)) of
ok -> {ok,Config};
Error -> Error
@@ -248,8 +248,8 @@ swap_buffer(Name, Buffer) ->
Config :: logger:config().
log(LogEvent, Config = #{id := Name,
- ?MODULE := #{handler_pid := HPid,
- mode_tab := ModeTab}}) ->
+ config := #{handler_pid := HPid,
+ mode_tab := ModeTab}}) ->
%% if the handler has crashed, we must drop this request
%% and hope the handler restarts so we can try again
true = is_process_alive(HPid),
@@ -260,7 +260,7 @@ log(LogEvent, Config = #{id := Name,
%%% gen_server callbacks
%%%===================================================================
-init([Name, Config = #{?MODULE := HConfig, disk_log_opts := LogOpts},
+init([Name, Config = #{config := HConfig, disk_log_opts := LogOpts},
State = #{dl_sync_int := DLSyncInt}]) ->
register(?name_to_reg_name(?MODULE,Name), self()),
process_flag(trap_exit, true),
@@ -291,8 +291,8 @@ init([Name, Config = #{?MODULE := HConfig, disk_log_opts := LogOpts},
prev_sync_result => ok,
prev_disk_log_info => undefined}),
Config1 =
- Config#{?MODULE => HConfig#{handler_pid => self(),
- mode_tab => ModeTab}},
+ Config#{config => HConfig#{handler_pid => self(),
+ mode_tab => ModeTab}},
proc_lib:init_ack({ok,self(),Config1}),
gen_server:cast(self(), repeated_disk_log_sync),
enter_loop(Config1, State1)
@@ -335,7 +335,7 @@ handle_call(disk_log_sync, _From, State = #{id := Name}) ->
handle_call({change_config,_OldConfig,NewConfig}, _From,
State = #{filesync_repeat_interval := FSyncInt0}) ->
- HConfig = maps:get(?MODULE, NewConfig, #{}),
+ HConfig = maps:get(config, NewConfig, #{}),
State1 = #{toggle_sync_qlen := TSQL,
drop_new_reqs_qlen := DNRQL,
flush_reqs_qlen := FRQL} = maps:merge(State, HConfig),
@@ -482,9 +482,9 @@ get_init_state() ->
%%% ignored.
%%%
%%% Handler specific config should be provided with a sub map associated
-%%% with a key named the same as this module, e.g:
+%%% with a key named 'config', e.g:
%%%
-%%% Config = #{logger_disk_log_h => #{toggle_sync_qlen => 50}
+%%% Config = #{config => #{toggle_sync_qlen => 50}
%%%
%%% The disk_log handler process is linked to logger_sup, which is
%%% part of the kernel application's supervision tree.
diff --git a/lib/kernel/src/logger_server.erl b/lib/kernel/src/logger_server.erl
index c7d386ab82..7df762053e 100644
--- a/lib/kernel/src/logger_server.erl
+++ b/lib/kernel/src/logger_server.erl
@@ -53,7 +53,7 @@ add_handler(Id,Module,Config0) ->
{ok,ok} ->
case sanity_check(Id,Config0) of
ok ->
- Default = default_config(Id),
+ Default = default_config(Id,Module),
Config = maps:merge(Default,Config0),
call({add_handler,Id,Module,Config});
Error ->
@@ -141,7 +141,7 @@ init([]) ->
PrimaryConfig = maps:merge(default_config(primary),
#{handlers=>[simple]}),
logger_config:create(Tid,primary,PrimaryConfig),
- SimpleConfig0 = maps:merge(default_config(simple),
+ SimpleConfig0 = maps:merge(default_config(simple,logger_simple_h),
#{filter_default=>stop,
filters=>?DEFAULT_HANDLER_FILTERS}),
%% If this fails, then the node should crash
@@ -365,6 +365,8 @@ default_config(Id) ->
filters=>[],
filter_default=>log,
formatter=>{?DEFAULT_FORMATTER,#{}}}.
+default_config(Id,Module) ->
+ (default_config(Id))#{module=>Module}.
sanity_check(Owner,Key,Value) ->
sanity_check_1(Owner,[{Key,Value}]).
diff --git a/lib/kernel/src/logger_std_h.erl b/lib/kernel/src/logger_std_h.erl
index 5ec9eced12..bebd5300b4 100644
--- a/lib/kernel/src/logger_std_h.erl
+++ b/lib/kernel/src/logger_std_h.erl
@@ -116,7 +116,7 @@ adding_handler(#{id:=Name}=Config) ->
case check_config(adding, Config) of
{ok, Config1} ->
%% create initial handler state by merging defaults with config
- HConfig = maps:get(?MODULE, Config1, #{}),
+ HConfig = maps:get(config, Config1, #{}),
HState = maps:merge(get_init_state(), HConfig),
case logger_h_common:overload_levels_ok(HState) of
true ->
@@ -140,17 +140,17 @@ adding_handler(#{id:=Name}=Config) ->
%%%-----------------------------------------------------------------
%%% Updating handler config
-changing_config(OldConfig=#{id:=Name, ?MODULE:=HConfig},
+changing_config(OldConfig=#{id:=Name, config:=HConfig},
NewConfig=#{id:=Name}) ->
#{type:=Type, handler_pid:=HPid, mode_tab:=ModeTab} = HConfig,
- MyConfig = maps:get(?MODULE, NewConfig, #{}),
+ MyConfig = maps:get(config, NewConfig, #{}),
case maps:get(type, MyConfig, Type) of
Type ->
MyConfig1 = MyConfig#{type=>Type,
handler_pid=>HPid,
mode_tab=>ModeTab},
changing_config1(HPid, OldConfig,
- NewConfig#{?MODULE=>MyConfig1});
+ NewConfig#{config=>MyConfig1});
_ ->
{error,{illegal_config_change,OldConfig,NewConfig}}
end;
@@ -173,17 +173,17 @@ changing_config1(HPid, OldConfig, NewConfig) ->
check_config(adding, Config) ->
%% Merge in defaults on handler level
- MyConfig0 = maps:get(?MODULE, Config, #{}),
+ MyConfig0 = maps:get(config, Config, #{}),
MyConfig = maps:merge(#{type => standard_io},
MyConfig0),
case check_my_config(maps:to_list(MyConfig)) of
ok ->
- {ok,Config#{?MODULE=>MyConfig}};
+ {ok,Config#{config=>MyConfig}};
Error ->
Error
end;
check_config(changing, Config) ->
- MyConfig = maps:get(?MODULE, Config, #{}),
+ MyConfig = maps:get(config, Config, #{}),
case check_my_config(maps:to_list(MyConfig)) of
ok -> {ok,Config};
Error -> Error
@@ -230,8 +230,8 @@ swap_buffer(Name, Buffer) ->
Config :: logger:config().
log(LogEvent, Config = #{id := Name,
- ?MODULE := #{handler_pid := HPid,
- mode_tab := ModeTab}}) ->
+ config := #{handler_pid := HPid,
+ mode_tab := ModeTab}}) ->
%% if the handler has crashed, we must drop this request
%% and hope the handler restarts so we can try again
true = is_process_alive(HPid),
@@ -242,7 +242,7 @@ log(LogEvent, Config = #{id := Name,
%%% gen_server callbacks
%%%===================================================================
-init([Name, Config = #{?MODULE := HConfig},
+init([Name, Config = #{config := HConfig},
State0 = #{type := Type, file_ctrl_sync_int := FileCtrlSyncInt}]) ->
register(?name_to_reg_name(?MODULE,Name), self()),
process_flag(trap_exit, true),
@@ -269,8 +269,8 @@ init([Name, Config = #{?MODULE := HConfig},
burst_win_ts => T0,
burst_msg_count => 0}),
Config1 =
- Config#{?MODULE => HConfig#{handler_pid => self(),
- mode_tab => ModeTab}},
+ Config#{config => HConfig#{handler_pid => self(),
+ mode_tab => ModeTab}},
proc_lib:init_ack({ok,self(),Config1}),
gen_server:cast(self(), repeated_filesync),
enter_loop(Config1, State1)
@@ -332,7 +332,7 @@ handle_call(filesync, _From, State = #{type := Type,
handle_call({change_config,_OldConfig,NewConfig}, _From,
State = #{filesync_repeat_interval := FSyncInt0}) ->
- HConfig = maps:get(?MODULE, NewConfig, #{}),
+ HConfig = maps:get(config, NewConfig, #{}),
State1 = maps:merge(State, HConfig),
case logger_h_common:overload_levels_ok(State1) of
true ->
@@ -470,9 +470,9 @@ get_init_state() ->
%%% exist if the handler is not registered).
%%%
%%% Handler specific config should be provided with a sub map associated
-%%% with a key named the same as this module, e.g:
+%%% with a key named 'config', e.g:
%%%
-%%% Config = #{logger_std_h => #{toggle_sync_qlen => 50}
+%%% Config = #{config => #{toggle_sync_qlen => 50}
%%%
%%% The standard handler process is linked to logger_sup, which is
%%% part of the kernel application's supervision tree.
diff --git a/lib/kernel/test/logger_SUITE.erl b/lib/kernel/test/logger_SUITE.erl
index c24738718e..ca0e7e23b5 100644
--- a/lib/kernel/test/logger_SUITE.erl
+++ b/lib/kernel/test/logger_SUITE.erl
@@ -260,7 +260,7 @@ change_config(_Config) ->
%% Check that internal 'handlers' field has not been changed
MS = [{{{?HANDLER_KEY,'$1'},'_','_','_'},[],['$1']}],
HIds1 = ets:select(?LOGGER_TABLE,MS), % dirty, checking internal data
- HIds2 = logger:get_handler_ids(),
+ HIds2 = lists:sort(logger:get_handler_ids()),
HIds1 = lists:sort(HIds2),
%% Cleanup
diff --git a/lib/kernel/test/logger_bench_SUITE.erl b/lib/kernel/test/logger_bench_SUITE.erl
index 5ac0ace41b..b60fc42741 100644
--- a/lib/kernel/test/logger_bench_SUITE.erl
+++ b/lib/kernel/test/logger_bench_SUITE.erl
@@ -67,7 +67,7 @@ do_init_per_group(console_handler) ->
ok = logger:add_handler(?MODULE,logger_std_h,
#{filter_default=>stop,
filters=>?DEFAULT_HANDLER_FILTERS,
- logger_std_h=>#{type=>standard_io,
+ config=>#{type=>standard_io,
toggle_sync_qlen => ?TIMES+1,
drop_new_reqs_qlen => ?TIMES+2,
flush_reqs_qlen => ?TIMES+3,
diff --git a/lib/kernel/test/logger_disk_log_h_SUITE.erl b/lib/kernel/test/logger_disk_log_h_SUITE.erl
index 4fada8ab3a..552cb05797 100644
--- a/lib/kernel/test/logger_disk_log_h_SUITE.erl
+++ b/lib/kernel/test/logger_disk_log_h_SUITE.erl
@@ -369,21 +369,21 @@ formatter_fail(cleanup,_Config) ->
config_fail(_Config) ->
{error,{handler_not_added,{invalid_config,logger_disk_log_h,{bad,bad}}}} =
logger:add_handler(?MODULE,logger_disk_log_h,
- #{logger_disk_log_h => #{bad => bad},
+ #{config => #{bad => bad},
filter_default=>log,
formatter=>{?MODULE,self()}}),
{error,{handler_not_added,{invalid_levels,{_,1,_}}}} =
logger:add_handler(?MODULE,logger_disk_log_h,
- #{logger_disk_log_h => #{drop_new_reqs_qlen=>1}}),
+ #{config => #{drop_new_reqs_qlen=>1}}),
{error,{handler_not_added,{invalid_levels,{43,42,_}}}} =
logger:add_handler(?MODULE,logger_disk_log_h,
- #{logger_disk_log_h => #{toggle_sync_qlen=>43,
- drop_new_reqs_qlen=>42}}),
+ #{config => #{toggle_sync_qlen=>43,
+ drop_new_reqs_qlen=>42}}),
{error,{handler_not_added,{invalid_levels,{_,43,42}}}} =
logger:add_handler(?MODULE,logger_disk_log_h,
- #{logger_disk_log_h => #{drop_new_reqs_qlen=>43,
- flush_reqs_qlen=>42}}),
+ #{config => #{drop_new_reqs_qlen=>43,
+ flush_reqs_qlen=>42}}),
ok = logger:add_handler(?MODULE,logger_disk_log_h,
#{filter_default=>log,
@@ -397,12 +397,12 @@ config_fail(_Config) ->
logger:set_handler_config(?MODULE,id,bad),
%% incorrect values of OP params
{error,{invalid_levels,_}} =
- logger:set_handler_config(?MODULE,logger_disk_log_h,
+ logger:set_handler_config(?MODULE,config,
#{toggle_sync_qlen=>100,
flush_reqs_qlen=>99}),
%% invalid name of config parameter
{error,{invalid_config,logger_disk_log_h,{filesync_rep_int,2000}}} =
- logger:set_handler_config(?MODULE, logger_disk_log_h,
+ logger:set_handler_config(?MODULE, config,
#{filesync_rep_int => 2000}),
ok.
config_fail(cleanup,_Config) ->
@@ -448,7 +448,7 @@ reconfig(Config) ->
file := _DiskLogFile}} =
logger_disk_log_h:info(?MODULE),
- ok = logger:set_handler_config(?MODULE, logger_disk_log_h,
+ ok = logger:set_handler_config(?MODULE, config,
#{toggle_sync_qlen => 1,
drop_new_reqs_qlen => 2,
flush_reqs_qlen => 3,
@@ -532,7 +532,7 @@ sync(Config) ->
%% check that if there's no repeated disk_log_sync active,
%% a disk_log_sync is still performed when handler goes idle
- logger:set_handler_config(?MODULE, logger_disk_log_h,
+ logger:set_handler_config(?MODULE, config,
#{filesync_repeat_interval => no_repeat}),
no_repeat = maps:get(filesync_repeat_interval,
logger_disk_log_h:info(?MODULE)),
@@ -559,12 +559,12 @@ sync(Config) ->
start_tracer([{logger_disk_log_h,handle_cast,2}],
[OneSync || _ <- lists:seq(1, 1 + trunc(WaitT/SyncInt))]),
- logger:set_handler_config(?MODULE, logger_disk_log_h,
+ logger:set_handler_config(?MODULE, config,
#{filesync_repeat_interval => SyncInt}),
SyncInt = maps:get(filesync_repeat_interval,
logger_disk_log_h:info(?MODULE)),
timer:sleep(WaitT),
- logger:set_handler_config(?MODULE, logger_disk_log_h,
+ logger:set_handler_config(?MODULE, config,
#{filesync_repeat_interval => no_repeat}),
check_tracer(100),
ok.
@@ -782,7 +782,7 @@ sync_failure(Config) ->
SyncInt = 500,
ok = rpc:call(Node, logger, set_handler_config,
- [?STANDARD_HANDLER, logger_disk_log_h,
+ [?STANDARD_HANDLER, config,
#{filesync_repeat_interval => SyncInt}]),
Info = rpc:call(Node, logger_disk_log_h, info, [?STANDARD_HANDLER]),
SyncInt = maps:get(filesync_repeat_interval, Info),
@@ -852,10 +852,10 @@ op_switch_to_sync(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NumOfReqs = 500,
NewHConfig =
- HConfig#{logger_disk_log_h => DLHConfig#{toggle_sync_qlen => 2,
- drop_new_reqs_qlen => NumOfReqs+1,
- flush_reqs_qlen => 2*NumOfReqs,
- enable_burst_limit => false}},
+ HConfig#{config => DLHConfig#{toggle_sync_qlen => 2,
+ drop_new_reqs_qlen => NumOfReqs+1,
+ flush_reqs_qlen => 2*NumOfReqs,
+ enable_burst_limit => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
send_burst({n,NumOfReqs}, seq, {chars,79}, info),
Lines = count_lines(Log),
@@ -876,7 +876,7 @@ op_switch_to_drop(Config) ->
Procs = 2,
Bursts = 10,
NewHConfig =
- HConfig#{logger_disk_log_h =>
+ HConfig#{config =>
DLHConfig#{toggle_sync_qlen => 1,
drop_new_reqs_qlen => 2,
flush_reqs_qlen => Procs*NumOfReqs*Bursts,
@@ -921,7 +921,7 @@ op_switch_to_flush(Config) ->
%% (verify with coverage of flush_log_requests/2)
NewHConfig =
- HConfig#{logger_disk_log_h =>
+ HConfig#{config =>
DLHConfig#{toggle_sync_qlen => 2,
%% disable drop mode
drop_new_reqs_qlen => 300,
@@ -964,11 +964,11 @@ op_switch_to_flush(cleanup, _Config) ->
limit_burst_disabled(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{logger_disk_log_h => DLHConfig#{enable_burst_limit => false,
- burst_limit_size => 10,
- burst_window_time => 2000,
- drop_new_reqs_qlen => 200,
- flush_reqs_qlen => 300}},
+ HConfig#{config => DLHConfig#{enable_burst_limit => false,
+ burst_limit_size => 10,
+ burst_window_time => 2000,
+ drop_new_reqs_qlen => 200,
+ flush_reqs_qlen => 300}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, info),
@@ -983,11 +983,11 @@ limit_burst_enabled_one(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
ReqLimit = 10,
NewHConfig =
- HConfig#{logger_disk_log_h => DLHConfig#{enable_burst_limit => true,
- burst_limit_size => ReqLimit,
- burst_window_time => 2000,
- drop_new_reqs_qlen => 200,
- flush_reqs_qlen => 300}},
+ HConfig#{config => DLHConfig#{enable_burst_limit => true,
+ burst_limit_size => ReqLimit,
+ burst_window_time => 2000,
+ drop_new_reqs_qlen => 200,
+ flush_reqs_qlen => 300}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, info),
@@ -1003,11 +1003,11 @@ limit_burst_enabled_period(Config) ->
ReqLimit = 10,
BurstTWin = 1000,
NewHConfig =
- HConfig#{logger_disk_log_h => DLHConfig#{enable_burst_limit => true,
- burst_limit_size => ReqLimit,
- burst_window_time => BurstTWin,
- drop_new_reqs_qlen => 20000,
- flush_reqs_qlen => 20001}},
+ HConfig#{config => DLHConfig#{enable_burst_limit => true,
+ burst_limit_size => ReqLimit,
+ burst_window_time => BurstTWin,
+ drop_new_reqs_qlen => 20000,
+ flush_reqs_qlen => 20001}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
Windows = 3,
@@ -1024,9 +1024,9 @@ limit_burst_enabled_period(cleanup, _Config) ->
kill_disabled(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{logger_disk_log_h=>DLHConfig#{enable_kill_overloaded=>false,
- handler_overloaded_qlen=>10,
- handler_overloaded_mem=>100}},
+ HConfig#{config=>DLHConfig#{enable_kill_overloaded=>false,
+ handler_overloaded_qlen=>10,
+ handler_overloaded_mem=>100}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, info),
@@ -1044,7 +1044,7 @@ qlen_kill_new(Config) ->
{_,Mem0} = process_info(Pid0, memory),
RestartAfter = ?HANDLER_RESTART_AFTER,
NewHConfig =
- HConfig#{logger_disk_log_h =>
+ HConfig#{config =>
DLHConfig#{enable_kill_overloaded=>true,
handler_overloaded_qlen=>10,
handler_overloaded_mem=>Mem0+50000,
@@ -1081,7 +1081,7 @@ mem_kill_new(Config) ->
{_,Mem0} = process_info(Pid0, memory),
RestartAfter = ?HANDLER_RESTART_AFTER,
NewHConfig =
- HConfig#{logger_disk_log_h =>
+ HConfig#{config =>
DLHConfig#{enable_kill_overloaded=>true,
handler_overloaded_qlen=>50000,
handler_overloaded_mem=>Mem0+500,
@@ -1115,9 +1115,9 @@ mem_kill_new(cleanup, _Config) ->
restart_after(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig1 =
- HConfig#{logger_disk_log_h=>DLHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_restart_after=>never}},
+ HConfig#{config=>DLHConfig#{enable_kill_overloaded=>true,
+ handler_overloaded_qlen=>10,
+ handler_restart_after=>never}},
ok = logger:set_handler_config(?MODULE, NewHConfig1),
MRef1 = erlang:monitor(process, whereis(h_proc_name())),
%% kill handler
@@ -1135,9 +1135,9 @@ restart_after(Config) ->
{Log,_,_} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
RestartAfter = ?HANDLER_RESTART_AFTER,
NewHConfig2 =
- HConfig#{logger_disk_log_h=>DLHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_restart_after=>RestartAfter}},
+ HConfig#{config=>DLHConfig#{enable_kill_overloaded=>true,
+ handler_overloaded_qlen=>10,
+ handler_restart_after=>RestartAfter}},
ok = logger:set_handler_config(?MODULE, NewHConfig2),
Pid0 = whereis(h_proc_name()),
MRef2 = erlang:monitor(process, Pid0),
@@ -1166,10 +1166,10 @@ handler_requests_under_load() ->
handler_requests_under_load(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{logger_disk_log_h => DLHConfig#{toggle_sync_qlen => 2,
- drop_new_reqs_qlen => 1000,
- flush_reqs_qlen => 2000,
- enable_burst_limit => false}},
+ HConfig#{config => DLHConfig#{toggle_sync_qlen => 2,
+ drop_new_reqs_qlen => 1000,
+ flush_reqs_qlen => 2000,
+ enable_burst_limit => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
Pid = spawn_link(fun() -> send_requests(?MODULE, 1, [{sync,[]},
{info,[]},
@@ -1227,7 +1227,7 @@ start_handler(Name, FuncName, Config) ->
filters=>?DEFAULT_HANDLER_FILTERS([Name]),
formatter=>{?MODULE,op},
level => info}),
- {ok,{_,HConfig = #{logger_disk_log_h := DLHConfig}}} =
+ {ok,{_,HConfig = #{config := DLHConfig}}} =
logger:get_handler_config(Name),
{lists:concat([File,".1"]),HConfig,DLHConfig}.
diff --git a/lib/kernel/test/logger_env_var_SUITE.erl b/lib/kernel/test/logger_env_var_SUITE.erl
index 7ef6341377..fcdfcfd6d0 100644
--- a/lib/kernel/test/logger_env_var_SUITE.erl
+++ b/lib/kernel/test/logger_env_var_SUITE.erl
@@ -205,7 +205,7 @@ logger_file(Config) ->
= setup(Config,
[{logger,
[{handler,?STANDARD_HANDLER,logger_std_h,
- #{logger_std_h=>#{type=>{file,Log}}}}]}]),
+ #{config=>#{type=>{file,Log}}}}]}]),
check_default_log(Node,Log,
file,% dest
0),% progress in std logger
@@ -227,7 +227,7 @@ logger_file_sasl_compatible(Config) ->
[{logger_sasl_compatible,true},
{logger,
[{handler,?STANDARD_HANDLER,logger_std_h,
- #{logger_std_h=>#{type=>{file,Log}}}}]}]),
+ #{config=>#{type=>{file,Log}}}}]}]),
check_default_log(Node,Log,
file,% dest
0),% progress in std logger
@@ -249,7 +249,7 @@ logger_file_log_progress(Config) ->
[{logger_progress_reports,log},
{logger,
[{handler,?STANDARD_HANDLER,logger_std_h,
- #{logger_std_h=>#{type=>{file,Log}}}}]}]),
+ #{config=>#{type=>{file,Log}}}}]}]),
check_default_log(Node,Log,
file,% dest
6),% progress in std logger
@@ -271,7 +271,7 @@ logger_file_no_filter(Config) ->
[{logger,
[{handler,?STANDARD_HANDLER,logger_std_h,
#{filter_default=>log,filters=>[],
- logger_std_h=>#{type=>{file,Log}}}}]}]),
+ config=>#{type=>{file,Log}}}}]}]),
check_default_log(Node,Log,
file,% dest
6),% progress in std logger
@@ -291,7 +291,7 @@ logger_file_no_filter_level(Config) ->
[{logger,
[{handler,?STANDARD_HANDLER,logger_std_h,
#{filters=>[],level=>error,
- logger_std_h=>#{type=>{file,Log}}}}]}]),
+ config=>#{type=>{file,Log}}}}]}]),
check_default_log(Node,Log,
file,% dest
0,% progress in std logger
@@ -313,7 +313,7 @@ logger_file_formatter(Config) ->
[{handler,?STANDARD_HANDLER,logger_std_h,
#{filters=>[],
formatter=>{logger_formatter,#{}},
- logger_std_h=>#{type=>{file,Log}}}}]}]),
+ config=>#{type=>{file,Log}}}}]}]),
check_single_log(Node,Log,
file,% dest
6),% progress in std logger
@@ -333,7 +333,7 @@ logger_filters(Config) ->
[{logger_progress_reports,log},
{logger,
[{handler,?STANDARD_HANDLER,logger_std_h,
- #{logger_std_h=>#{type=>{file,Log}}}},
+ #{config=>#{type=>{file,Log}}}},
{filters,log,[{stop_progress,{fun logger_filters:progress/2,stop}}]}
]}]),
check_default_log(Node,Log,
@@ -360,7 +360,7 @@ logger_filters_stop(Config) ->
{logger,
[{handler,?STANDARD_HANDLER,logger_std_h,
#{filters=>[],
- logger_std_h=>#{type=>{file,Log}}}},
+ config=>#{type=>{file,Log}}}},
{filters,stop,[{log_error,{fun logger_filters:level/2,{log,gt,info}}}]}
]}]),
check_default_log(Node,Log,
@@ -385,7 +385,7 @@ logger_module_level(Config) ->
[{logger_progress_reports,log},
{logger,
[{handler,?STANDARD_HANDLER,logger_std_h,
- #{logger_std_h=>#{type=>{file,Log}}}},
+ #{config=>#{type=>{file,Log}}}},
{module_level,error,[supervisor]}
]}]),
check_default_log(Node,Log,
@@ -469,12 +469,12 @@ logger_many_handlers_default_first(Config) ->
#{level=>error,
filters=>[],
formatter=>{logger_formatter,#{}},
- logger_std_h=>#{type=>{file,LogErr}}}
+ config=>#{type=>{file,LogErr}}}
},
{handler,info,logger_std_h,
#{level=>info,
filters=>[{level,{fun logger_filters:level/2,{stop,gteq,error}}}],
- logger_std_h=>#{type=>{file,LogInfo}}}
+ config=>#{type=>{file,LogInfo}}}
}
]}], LogErr, LogInfo, 6).
@@ -487,13 +487,13 @@ logger_many_handlers_default_last(Config) ->
[{handler,info,logger_std_h,
#{level=>info,
filters=>[{level,{fun logger_filters:level/2,{stop,gteq,error}}}],
- logger_std_h=>#{type=>{file,LogInfo}}}
+ config=>#{type=>{file,LogInfo}}}
},
{handler,?STANDARD_HANDLER,logger_std_h,
#{level=>error,
filters=>[],
formatter=>{logger_formatter,#{}},
- logger_std_h=>#{type=>{file,LogErr}}}
+ config=>#{type=>{file,LogErr}}}
}
]}], LogErr, LogInfo, 7).
@@ -509,13 +509,13 @@ logger_many_handlers_default_last_broken_filter(Config) ->
#{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}}}
+ config=>#{type=>{file,LogInfo}}}
},
{handler,?STANDARD_HANDLER,logger_std_h,
#{level=>error,
filters=>[],
formatter=>{logger_formatter,#{}},
- logger_std_h=>#{type=>{file,LogErr}}}
+ config=>#{type=>{file,LogErr}}}
}
]}], LogErr, LogInfo, 7).
diff --git a/lib/kernel/test/logger_simple_h_SUITE.erl b/lib/kernel/test/logger_simple_h_SUITE.erl
index 264cddb069..9f34bbbe34 100644
--- a/lib/kernel/test/logger_simple_h_SUITE.erl
+++ b/lib/kernel/test/logger_simple_h_SUITE.erl
@@ -138,7 +138,7 @@ replace_file(Config) ->
ok = rpc:call(Node, logger, add_handlers,
[[{handler, default, logger_std_h,
- #{ logger_std_h => #{ type => {file, File} },
+ #{ config => #{ type => {file, File} },
formatter => {?DEFAULT_FORMATTER,?DEFAULT_FORMAT_CONFIG}}}]]),
{ok,Bin} = sync_and_read(Node, file, File),
diff --git a/lib/kernel/test/logger_std_h_SUITE.erl b/lib/kernel/test/logger_std_h_SUITE.erl
index 332d58eac8..97b5c03a86 100644
--- a/lib/kernel/test/logger_std_h_SUITE.erl
+++ b/lib/kernel/test/logger_std_h_SUITE.erl
@@ -132,7 +132,7 @@ all() ->
add_remove_instance_tty(_Config) ->
{error,{handler_not_added,{invalid_config,logger_std_h,{type,tty}}}} =
logger:add_handler(?MODULE,logger_std_h,
- #{logger_std_h => #{type => tty},
+ #{config => #{type => tty},
filter_default=>log,
formatter=>{?MODULE,self()}}),
ok.
@@ -166,7 +166,7 @@ add_remove_instance_file2(cleanup,_Config) ->
add_remove_instance_file(Log, Type) ->
ok = logger:add_handler(?MODULE,
logger_std_h,
- #{logger_std_h => #{type => Type},
+ #{config => #{type => Type},
filter_default=>stop,
filters=>?DEFAULT_HANDLER_FILTERS([?MODULE]),
formatter=>{?MODULE,self()}}),
@@ -212,18 +212,18 @@ errors(Config) ->
{handler_not_added,
{invalid_config,logger_std_h,{type,faulty_type}}}} =
logger:add_handler(?MODULE,logger_std_h,
- #{logger_std_h => #{type => faulty_type}}),
+ #{config => #{type => faulty_type}}),
NoDir = lists:concat(["/",?MODULE,"_dir"]),
{error,
{handler_not_added,{{open_failed,NoDir,eacces},_}}} =
logger:add_handler(myh2,logger_std_h,
- #{logger_std_h=>#{type=>{file,NoDir}}}),
+ #{config=>#{type=>{file,NoDir}}}),
{error,
{handler_not_added,{{open_failed,Log,_},_}}} =
logger:add_handler(myh3,logger_std_h,
- #{logger_std_h=>#{type=>{file,Log,[bad_file_opt]}}}),
+ #{config=>#{type=>{file,Log,[bad_file_opt]}}}),
ok = logger:info(?msg).
@@ -237,7 +237,7 @@ formatter_fail(Config) ->
%% no formatter
ok = logger:add_handler(?MODULE,
logger_std_h,
- #{logger_std_h => #{type => {file,Log}},
+ #{config => #{type => {file,Log}},
filter_default=>stop,
filters=>?DEFAULT_HANDLER_FILTERS([?MODULE])}),
Pid = whereis(h_proc_name()),
@@ -281,41 +281,41 @@ formatter_fail(cleanup,_Config) ->
config_fail(_Config) ->
{error,{handler_not_added,{invalid_config,logger_std_h,{bad,bad}}}} =
logger:add_handler(?MODULE,logger_std_h,
- #{logger_std_h => #{bad => bad},
+ #{config => #{bad => bad},
filter_default=>log,
formatter=>{?MODULE,self()}}),
{error,{handler_not_added,{invalid_config,logger_std_h,
{restart_type,bad}}}} =
logger:add_handler(?MODULE,logger_std_h,
- #{logger_std_h => #{restart_type => bad},
+ #{config => #{restart_type => bad},
filter_default=>log,
formatter=>{?MODULE,self()}}),
{error,{handler_not_added,{invalid_levels,{_,1,_}}}} =
logger:add_handler(?MODULE,logger_std_h,
- #{logger_std_h => #{drop_new_reqs_qlen=>1}}),
+ #{config => #{drop_new_reqs_qlen=>1}}),
{error,{handler_not_added,{invalid_levels,{43,42,_}}}} =
logger:add_handler(?MODULE,logger_std_h,
- #{logger_std_h => #{toggle_sync_qlen=>43,
- drop_new_reqs_qlen=>42}}),
+ #{config => #{toggle_sync_qlen=>43,
+ drop_new_reqs_qlen=>42}}),
{error,{handler_not_added,{invalid_levels,{_,43,42}}}} =
logger:add_handler(?MODULE,logger_std_h,
- #{logger_std_h => #{drop_new_reqs_qlen=>43,
- flush_reqs_qlen=>42}}),
+ #{config => #{drop_new_reqs_qlen=>43,
+ flush_reqs_qlen=>42}}),
ok = logger:add_handler(?MODULE,logger_std_h,
#{filter_default=>log,
formatter=>{?MODULE,self()}}),
{error,{illegal_config_change,_,_}} =
- logger:set_handler_config(?MODULE,logger_std_h,
+ logger:set_handler_config(?MODULE,config,
#{type=>{file,"file"}}),
{error,{illegal_config_change,_,_}} =
logger:set_handler_config(?MODULE,id,bad),
{error,{invalid_levels,_}} =
- logger:set_handler_config(?MODULE,logger_std_h,
+ logger:set_handler_config(?MODULE,config,
#{toggle_sync_qlen=>100,
flush_reqs_qlen=>99}),
{error,{invalid_config,logger_std_h,{filesync_rep_int,2000}}} =
- logger:set_handler_config(?MODULE, logger_std_h,
+ logger:set_handler_config(?MODULE, config,
#{filesync_rep_int => 2000}),
ok.
@@ -327,7 +327,7 @@ crash_std_h_to_file(Config) ->
Log = filename:join(Dir,lists:concat([?MODULE,"_",?FUNCTION_NAME,".log"])),
crash_std_h(Config,?FUNCTION_NAME,
[{handler,default,logger_std_h,
- #{ logger_std_h => #{ type => {file, Log} }}}],
+ #{ config => #{ type => {file, Log} }}}],
file, Log).
crash_std_h_to_file(cleanup,_Config) ->
crash_std_h(cleanup).
@@ -426,7 +426,7 @@ reconfig(Config) ->
Dir = ?config(priv_dir,Config),
ok = logger:add_handler(?MODULE,
logger_std_h,
- #{logger_std_h => #{type => standard_io},
+ #{config => #{type => standard_io},
filter_default=>log,
filters=>?DEFAULT_HANDLER_FILTERS([?MODULE]),
formatter=>{?MODULE,self()}}),
@@ -446,7 +446,7 @@ reconfig(Config) ->
filesync_repeat_interval := ?FILESYNC_REPEAT_INTERVAL} =
logger_std_h:info(?MODULE),
- ok = logger:set_handler_config(?MODULE, logger_std_h,
+ ok = logger:set_handler_config(?MODULE, config,
#{toggle_sync_qlen => 1,
drop_new_reqs_qlen => 2,
flush_reqs_qlen => 3,
@@ -485,13 +485,13 @@ file_opts(Config) ->
BadType = {file,Log,BadFileOpts},
{error,{handler_not_added,{{open_failed,Log,enoent},_}}} =
logger:add_handler(?MODULE, logger_std_h,
- #{logger_std_h => #{type => BadType}}),
+ #{config => #{type => BadType}}),
OkFileOpts = [raw,append],
OkType = {file,Log,OkFileOpts},
ok = logger:add_handler(?MODULE,
logger_std_h,
- #{logger_std_h => #{type => OkType},
+ #{config => #{type => OkType},
filter_default=>log,
filters=>?DEFAULT_HANDLER_FILTERS([?MODULE]),
formatter=>{?MODULE,self()}}),
@@ -512,7 +512,7 @@ sync(Config) ->
Type = {file,Log},
ok = logger:add_handler(?MODULE,
logger_std_h,
- #{logger_std_h => #{type => Type},
+ #{config => #{type => Type},
filter_default=>log,
filters=>?DEFAULT_HANDLER_FILTERS([?MODULE]),
formatter=>{?MODULE,nl}}),
@@ -547,7 +547,7 @@ sync(Config) ->
%% check that if there's no repeated filesync active,
%% a filesync is still performed when handler goes idle
- logger:set_handler_config(?MODULE, logger_std_h,
+ logger:set_handler_config(?MODULE, config,
#{filesync_repeat_interval => no_repeat}),
no_repeat = maps:get(filesync_repeat_interval, logger_std_h:info(?MODULE)),
%% The following timer is to make sure the time from last log
@@ -578,11 +578,11 @@ sync(Config) ->
start_tracer([{logger_std_h,handle_cast,2}],
[OneSync || _ <- lists:seq(1, 1 + trunc(WaitT/SyncInt))]),
- logger:set_handler_config(?MODULE, logger_std_h,
+ logger:set_handler_config(?MODULE, config,
#{filesync_repeat_interval => SyncInt}),
SyncInt = maps:get(filesync_repeat_interval, logger_std_h:info(?MODULE)),
timer:sleep(WaitT),
- logger:set_handler_config(?MODULE, logger_std_h,
+ logger:set_handler_config(?MODULE, config,
#{filesync_repeat_interval => no_repeat}),
check_tracer(100),
ok.
@@ -639,7 +639,7 @@ sync_failure(Config) ->
SyncInt = 500,
ok = rpc:call(Node, logger, set_handler_config,
- [?STANDARD_HANDLER, logger_std_h,
+ [?STANDARD_HANDLER, config,
#{filesync_repeat_interval => SyncInt}]),
Info = rpc:call(Node, logger_std_h, info, [?STANDARD_HANDLER]),
SyncInt = maps:get(filesync_repeat_interval, Info),
@@ -672,7 +672,7 @@ start_std_h_on_new_node(Config, Log) ->
logger_test_lib:setup(
Config,
[{logger,[{handler,default,logger_std_h,
- #{ logger_std_h => #{ type => {file,Log}}}}]}]),
+ #{ config => #{ type => {file,Log}}}}]}]),
ok = rpc:call(Node,logger,set_handler_config,[?STANDARD_HANDLER,formatter,
{?MODULE,nl}]),
Node.
@@ -700,10 +700,10 @@ op_switch_to_sync_file(Config) ->
{Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NumOfReqs = 500,
NewHConfig =
- HConfig#{logger_std_h => StdHConfig#{toggle_sync_qlen => 2,
- drop_new_reqs_qlen => NumOfReqs+1,
- flush_reqs_qlen => 2*NumOfReqs,
- enable_burst_limit => false}},
+ HConfig#{config => StdHConfig#{toggle_sync_qlen => 2,
+ drop_new_reqs_qlen => NumOfReqs+1,
+ flush_reqs_qlen => 2*NumOfReqs,
+ enable_burst_limit => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
%% TRecvPid = start_op_trace(),
send_burst({n,NumOfReqs}, seq, {chars,79}, info),
@@ -729,10 +729,10 @@ op_switch_to_sync_tty(Config) ->
{HConfig,StdHConfig} = start_handler(?MODULE, standard_io, Config),
NumOfReqs = 500,
NewHConfig =
- HConfig#{logger_std_h => StdHConfig#{toggle_sync_qlen => 3,
- drop_new_reqs_qlen => NumOfReqs+1,
- flush_reqs_qlen => 2*NumOfReqs,
- enable_burst_limit => false}},
+ HConfig#{config => StdHConfig#{toggle_sync_qlen => 3,
+ drop_new_reqs_qlen => NumOfReqs+1,
+ flush_reqs_qlen => 2*NumOfReqs,
+ enable_burst_limit => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
send_burst({n,NumOfReqs}, seq, {chars,79}, info),
ok.
@@ -750,7 +750,7 @@ op_switch_to_drop_file(Config) ->
Procs = 2,
Bursts = 10,
NewHConfig =
- HConfig#{logger_std_h =>
+ HConfig#{config =>
StdHConfig#{toggle_sync_qlen => 1,
drop_new_reqs_qlen => 2,
flush_reqs_qlen =>
@@ -788,11 +788,11 @@ op_switch_to_drop_tty(Config) ->
NumOfReqs = 300,
Procs = 2,
NewHConfig =
- HConfig#{logger_std_h => StdHConfig#{toggle_sync_qlen => 1,
- drop_new_reqs_qlen => 2,
- flush_reqs_qlen =>
- Procs*NumOfReqs+1,
- enable_burst_limit => false}},
+ HConfig#{config => StdHConfig#{toggle_sync_qlen => 1,
+ drop_new_reqs_qlen => 2,
+ flush_reqs_qlen =>
+ Procs*NumOfReqs+1,
+ enable_burst_limit => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
send_burst({n,NumOfReqs}, {spawn,Procs,0}, {chars,79}, info),
ok.
@@ -812,7 +812,7 @@ op_switch_to_flush_file(Config) ->
%% (verify with coverage of flush_log_requests/2)
NewHConfig =
- HConfig#{logger_std_h =>
+ HConfig#{config =>
StdHConfig#{toggle_sync_qlen => 2,
%% disable drop mode
drop_new_reqs_qlen => 300,
@@ -858,11 +858,11 @@ op_switch_to_flush_tty(Config) ->
%% when the flush happens (verify with coverage of flush_log_requests/2)
NewHConfig =
- HConfig#{logger_std_h => StdHConfig#{toggle_sync_qlen => 2,
- %% disable drop mode
- drop_new_reqs_qlen => 100,
- flush_reqs_qlen => 100,
- enable_burst_limit => false}},
+ HConfig#{config => StdHConfig#{toggle_sync_qlen => 2,
+ %% disable drop mode
+ drop_new_reqs_qlen => 100,
+ flush_reqs_qlen => 100,
+ enable_burst_limit => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 1000,
Procs = 100,
@@ -874,11 +874,11 @@ op_switch_to_flush_tty(cleanup, _Config) ->
limit_burst_disabled(Config) ->
{Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{logger_std_h => StdHConfig#{enable_burst_limit => false,
- burst_limit_size => 10,
- burst_window_time => 2000,
- drop_new_reqs_qlen => 200,
- flush_reqs_qlen => 300}},
+ HConfig#{config => StdHConfig#{enable_burst_limit => false,
+ burst_limit_size => 10,
+ burst_window_time => 2000,
+ drop_new_reqs_qlen => 200,
+ flush_reqs_qlen => 300}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, info),
@@ -893,11 +893,11 @@ limit_burst_enabled_one(Config) ->
{Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
ReqLimit = 10,
NewHConfig =
- HConfig#{logger_std_h => StdHConfig#{enable_burst_limit => true,
- burst_limit_size => ReqLimit,
- burst_window_time => 2000,
- drop_new_reqs_qlen => 200,
- flush_reqs_qlen => 300}},
+ HConfig#{config => StdHConfig#{enable_burst_limit => true,
+ burst_limit_size => ReqLimit,
+ burst_window_time => 2000,
+ drop_new_reqs_qlen => 200,
+ flush_reqs_qlen => 300}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, info),
@@ -913,11 +913,11 @@ limit_burst_enabled_period(Config) ->
ReqLimit = 10,
BurstTWin = 1000,
NewHConfig =
- HConfig#{logger_std_h => StdHConfig#{enable_burst_limit => true,
- burst_limit_size => ReqLimit,
- burst_window_time => BurstTWin,
- drop_new_reqs_qlen => 20000,
- flush_reqs_qlen => 20001}},
+ HConfig#{config => StdHConfig#{enable_burst_limit => true,
+ burst_limit_size => ReqLimit,
+ burst_window_time => BurstTWin,
+ drop_new_reqs_qlen => 20000,
+ flush_reqs_qlen => 20001}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
Windows = 3,
@@ -934,9 +934,9 @@ limit_burst_enabled_period(cleanup, _Config) ->
kill_disabled(Config) ->
{Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{logger_std_h=>StdHConfig#{enable_kill_overloaded=>false,
- handler_overloaded_qlen=>10,
- handler_overloaded_mem=>100}},
+ HConfig#{config=>StdHConfig#{enable_kill_overloaded=>false,
+ handler_overloaded_qlen=>10,
+ handler_overloaded_mem=>100}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, info),
@@ -954,10 +954,10 @@ qlen_kill_new(Config) ->
{_,Mem0} = process_info(Pid0, memory),
RestartAfter = ?HANDLER_RESTART_AFTER,
NewHConfig =
- HConfig#{logger_std_h=>StdHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_overloaded_mem=>Mem0+50000,
- handler_restart_after=>RestartAfter}},
+ HConfig#{config=>StdHConfig#{enable_kill_overloaded=>true,
+ handler_overloaded_qlen=>10,
+ handler_overloaded_mem=>Mem0+50000,
+ handler_restart_after=>RestartAfter}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
MRef = erlang:monitor(process, Pid0),
NumOfReqs = 100,
@@ -993,7 +993,7 @@ qlen_kill_std(_Config) ->
%% Log = filename:join(Dir, File),
%% Node = start_std_h_on_new_node(Config, ?FUNCTION_NAME, Log),
%% ok = rpc:call(Node, logger, set_handler_config,
- %% [?STANDARD_HANDLER, logger_std_h,
+ %% [?STANDARD_HANDLER, config,
%% #{enable_kill_overloaded=>true,
%% handler_overloaded_qlen=>10,
%% handler_overloaded_mem=>100000}]),
@@ -1005,10 +1005,10 @@ mem_kill_new(Config) ->
{_,Mem0} = process_info(Pid0, memory),
RestartAfter = ?HANDLER_RESTART_AFTER,
NewHConfig =
- HConfig#{logger_std_h=>StdHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>50000,
- handler_overloaded_mem=>Mem0+500,
- handler_restart_after=>RestartAfter}},
+ HConfig#{config=>StdHConfig#{enable_kill_overloaded=>true,
+ handler_overloaded_qlen=>50000,
+ handler_overloaded_mem=>Mem0+500,
+ handler_restart_after=>RestartAfter}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
MRef = erlang:monitor(process, Pid0),
NumOfReqs = 100,
@@ -1043,9 +1043,9 @@ mem_kill_std(_Config) ->
restart_after(Config) ->
{Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig1 =
- HConfig#{logger_std_h=>StdHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_restart_after=>never}},
+ HConfig#{config=>StdHConfig#{enable_kill_overloaded=>true,
+ handler_overloaded_qlen=>10,
+ handler_restart_after=>never}},
ok = logger:set_handler_config(?MODULE, NewHConfig1),
MRef1 = erlang:monitor(process, whereis(h_proc_name())),
%% kill handler
@@ -1063,9 +1063,9 @@ restart_after(Config) ->
{Log,_,_} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
RestartAfter = ?HANDLER_RESTART_AFTER,
NewHConfig2 =
- HConfig#{logger_std_h=>StdHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_restart_after=>RestartAfter}},
+ HConfig#{config=>StdHConfig#{enable_kill_overloaded=>true,
+ handler_overloaded_qlen=>10,
+ handler_restart_after=>RestartAfter}},
ok = logger:set_handler_config(?MODULE, NewHConfig2),
Pid0 = whereis(h_proc_name()),
MRef2 = erlang:monitor(process, Pid0),
@@ -1095,10 +1095,10 @@ handler_requests_under_load(Config) ->
{Log,HConfig,StdHConfig} =
start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{logger_std_h => StdHConfig#{toggle_sync_qlen => 2,
- drop_new_reqs_qlen => 1000,
- flush_reqs_qlen => 2000,
- enable_burst_limit => false}},
+ HConfig#{config => StdHConfig#{toggle_sync_qlen => 2,
+ drop_new_reqs_qlen => 1000,
+ flush_reqs_qlen => 2000,
+ enable_burst_limit => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
Pid = spawn_link(fun() -> send_requests(?MODULE, 1, [{sync,[]},
{info,[]},
@@ -1131,7 +1131,7 @@ send_requests(HName, TO, Reqs = [{Req,Res}|Rs]) ->
Result =
case Req of
change_config ->
- logger:set_handler_config(HName, logger_std_h,
+ logger:set_handler_config(HName, config,
#{enable_kill_overloaded =>
false});
Func ->
@@ -1147,11 +1147,11 @@ start_handler(Name, TTY, Config) when TTY == standard_io;
TTY == standard_error->
ok = logger:add_handler(Name,
logger_std_h,
- #{logger_std_h => #{type => TTY},
+ #{config => #{type => TTY},
filter_default=>log,
filters=>?DEFAULT_HANDLER_FILTERS([Name]),
formatter=>{?MODULE,op}}),
- {ok,{_,HConfig = #{logger_std_h := StdHConfig}}} =
+ {ok,{_,HConfig = #{config := StdHConfig}}} =
logger:get_handler_config(Name),
{HConfig,StdHConfig};
@@ -1162,11 +1162,11 @@ start_handler(Name, FuncName, Config) ->
Type = {file,Log},
ok = logger:add_handler(Name,
logger_std_h,
- #{logger_std_h => #{type => Type},
+ #{config => #{type => Type},
filter_default=>log,
filters=>?DEFAULT_HANDLER_FILTERS([Name]),
formatter=>{?MODULE,op}}),
- {ok,{_,HConfig = #{logger_std_h := StdHConfig}}} =
+ {ok,{_,HConfig = #{config := StdHConfig}}} =
logger:get_handler_config(Name),
{Log,HConfig,StdHConfig}.
@@ -1285,7 +1285,7 @@ format(#{msg:={string,String0}},Pid) ->
add_remove_instance_nofile(Type) ->
ok = logger:add_handler(?MODULE,logger_std_h,
- #{logger_std_h => #{type => Type},
+ #{config => #{type => Type},
filter_default=>stop,
filters=>?DEFAULT_HANDLER_FILTERS([?MODULE]),
formatter=>{?MODULE,self()}}),