diff --git a/apps/emqx/src/config/emqx_config_logger.erl b/apps/emqx/src/config/emqx_config_logger.erl index a7bf54aee..4b9180175 100644 --- a/apps/emqx/src/config/emqx_config_logger.erl +++ b/apps/emqx/src/config/emqx_config_logger.erl @@ -151,7 +151,7 @@ tr_file_handler({HandlerName, SubConf}) -> level => conf_get("level", SubConf), config => (log_handler_conf(SubConf))#{ type => wrap, - file => conf_get("to", SubConf), + file => conf_get("path", SubConf), max_no_files => conf_get("rotation_count", SubConf), max_no_bytes => conf_get("rotation_size", SubConf) }, diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl index 9725c2da9..1fec22715 100644 --- a/apps/emqx_conf/src/emqx_conf_schema.erl +++ b/apps/emqx_conf/src/emqx_conf_schema.erl @@ -909,13 +909,13 @@ fields("console_handler") -> log_handler_common_confs(console); fields("log_file_handler") -> [ - {"to", + {"path", sc( file(), #{ desc => ?DESC("log_file_handler_file"), default => <<"${EMQX_LOG_DIR}/emqx.log">>, - aliases => [file], + aliases => [file, to], importance => ?IMPORTANCE_HIGH, converter => fun(Path, Opts) -> emqx_schema:naive_env_interpolation(ensure_unicode_path(Path, Opts)) diff --git a/apps/emqx_conf/test/emqx_conf_logger_SUITE.erl b/apps/emqx_conf/test/emqx_conf_logger_SUITE.erl index ba74ed986..a53a81565 100644 --- a/apps/emqx_conf/test/emqx_conf_logger_SUITE.erl +++ b/apps/emqx_conf/test/emqx_conf_logger_SUITE.erl @@ -43,7 +43,7 @@ file { enable = true level = info - to = \"log/emqx.log\" + path = \"log/emqx.log\" } } """). @@ -67,7 +67,7 @@ t_log_conf(_Conf) -> <<"rotation_count">> => 10, <<"rotation_size">> => <<"50MB">>, <<"time_offset">> => <<"system">>, - <<"to">> => <<"log/emqx.log">> + <<"path">> => <<"log/emqx.log">> }, ExpectLog1 = #{ <<"console">> => diff --git a/apps/emqx_conf/test/emqx_conf_schema_tests.erl b/apps/emqx_conf/test/emqx_conf_schema_tests.erl index d274052f9..8e056c018 100644 --- a/apps/emqx_conf/test/emqx_conf_schema_tests.erl +++ b/apps/emqx_conf/test/emqx_conf_schema_tests.erl @@ -206,7 +206,7 @@ log_rotation_count_limit_test() -> """ log.file { enable = true - to = \"log/emqx.log\" + path = \"log/emqx.log\" formatter = text level = debug rotation = {count = ~w} @@ -434,7 +434,7 @@ log_path_test_() -> #{<<"log">> => #{<<"file_handlers">> => #{<<"name1">> => #{<<"file">> => Path}}}} end, Assert = fun(Name, Path, Conf) -> - ?assertMatch(#{log := #{file := #{Name := #{to := Path}}}}, Conf) + ?assertMatch(#{log := #{file := #{Name := #{path := Path}}}}, Conf) end, [ @@ -452,7 +452,7 @@ log_path_test_() -> "handler_name" := #{ kind := validation_error, - path := "log.file.name1.to", + path := "log.file.name1.path", reason := {"bad_file_path_string", _} } } @@ -471,7 +471,7 @@ log_path_test_() -> "handler_name" := #{ kind := validation_error, - path := "log.file.name1.to", + path := "log.file.name1.path", reason := {"not_string", _} } } diff --git a/changes/ce/feat-11062.en.md b/changes/ce/feat-11062.en.md new file mode 100644 index 000000000..1cfc19411 --- /dev/null +++ b/changes/ce/feat-11062.en.md @@ -0,0 +1 @@ +Rename `log.file.to` to `log.file.path`.