test: nodes's log test failed

This commit is contained in:
Zhongwen Deng 2023-05-09 11:56:12 +08:00
parent ad111a27f9
commit c901f3a9d4
2 changed files with 4 additions and 4 deletions

View File

@ -151,7 +151,7 @@ log_path() ->
Configs = logger:get_handler_config(),
case get_log_path(Configs) of
undefined ->
<<"log.file_handler.default.enable is false, not logging to file.">>;
<<"log.file.enable is false, not logging to file.">>;
Path ->
iolist_to_binary(filename:join(RootDir, Path))
end.

View File

@ -34,8 +34,8 @@ init_per_testcase(t_log_path, Config) ->
emqx_config_logger:add_handler(),
Log = emqx_conf:get_raw([log], #{}),
File = "log/emqx-test.log",
Log1 = emqx_utils_maps:deep_put([<<"file_handlers">>, <<"default">>, <<"enable">>], Log, true),
Log2 = emqx_utils_maps:deep_put([<<"file_handlers">>, <<"default">>, <<"file">>], Log1, File),
Log1 = emqx_utils_maps:deep_put([<<"file">>, <<"default">>, <<"enable">>], Log, true),
Log2 = emqx_utils_maps:deep_put([<<"file">>, <<"default">>, <<"to">>], Log1, File),
{ok, #{}} = emqx_conf:update([log], Log2, #{rawconf_with_defaults => true}),
Config;
init_per_testcase(_, Config) ->
@ -43,7 +43,7 @@ init_per_testcase(_, Config) ->
end_per_testcase(t_log_path, Config) ->
Log = emqx_conf:get_raw([log], #{}),
Log1 = emqx_utils_maps:deep_put([<<"file_handlers">>, <<"default">>, <<"enable">>], Log, false),
Log1 = emqx_utils_maps:deep_put([<<"file">>, <<"default">>, <<"enable">>], Log, false),
{ok, #{}} = emqx_conf:update([log], Log1, #{rawconf_with_defaults => true}),
emqx_config_logger:remove_handler(),
Config;