feat: alias log.file.to to log.file.file
This commit is contained in:
parent
14952658d5
commit
ad111a27f9
|
@ -29,7 +29,7 @@
|
||||||
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.9.6"}}},
|
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.9.6"}}},
|
||||||
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.15.1"}}},
|
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.15.1"}}},
|
||||||
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.8.1"}}},
|
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.8.1"}}},
|
||||||
{hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.39.5"}}},
|
{hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.39.6"}}},
|
||||||
{emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.2"}}},
|
{emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.2"}}},
|
||||||
{pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}},
|
{pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}},
|
||||||
{recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}},
|
{recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}},
|
||||||
|
|
|
@ -151,7 +151,7 @@ tr_file_handler({HandlerName, SubConf}) ->
|
||||||
level => conf_get("level", SubConf),
|
level => conf_get("level", SubConf),
|
||||||
config => (log_handler_conf(SubConf))#{
|
config => (log_handler_conf(SubConf))#{
|
||||||
type => wrap,
|
type => wrap,
|
||||||
file => conf_get("sink_to", SubConf),
|
file => conf_get("to", SubConf),
|
||||||
max_no_files => conf_get("rotation_count", SubConf),
|
max_no_files => conf_get("rotation_count", SubConf),
|
||||||
max_no_bytes => conf_get("rotation_size", SubConf)
|
max_no_bytes => conf_get("rotation_size", SubConf)
|
||||||
},
|
},
|
||||||
|
|
|
@ -891,7 +891,7 @@ fields("console_handler") ->
|
||||||
log_handler_common_confs(console);
|
log_handler_common_confs(console);
|
||||||
fields("log_file_handler") ->
|
fields("log_file_handler") ->
|
||||||
[
|
[
|
||||||
{"sink_to",
|
{"to",
|
||||||
sc(
|
sc(
|
||||||
file(),
|
file(),
|
||||||
#{
|
#{
|
||||||
|
|
|
@ -180,7 +180,7 @@ validate_log(Conf) ->
|
||||||
}
|
}
|
||||||
log.file {
|
log.file {
|
||||||
enable = false
|
enable = false
|
||||||
file = \"log/emqx.log\"
|
file = \"log/xx-emqx.log\"
|
||||||
formatter = text
|
formatter = text
|
||||||
level = debug
|
level = debug
|
||||||
rotation_count = 20
|
rotation_count = 20
|
||||||
|
@ -197,6 +197,48 @@ validate_log(Conf) ->
|
||||||
log_test() ->
|
log_test() ->
|
||||||
validate_log(?KERNEL_LOG_CONF).
|
validate_log(?KERNEL_LOG_CONF).
|
||||||
|
|
||||||
|
%% erlfmt-ignore
|
||||||
|
log_rotation_count_limit_test() ->
|
||||||
|
Format =
|
||||||
|
"""
|
||||||
|
log.file {
|
||||||
|
enable = true
|
||||||
|
to = \"log/emqx.log\"
|
||||||
|
formatter = text
|
||||||
|
level = debug
|
||||||
|
rotation = {count = ~w}
|
||||||
|
rotation_size = \"1024MB\"
|
||||||
|
}
|
||||||
|
""",
|
||||||
|
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]),
|
||||||
|
lists:foreach(fun({Conf, Count}) ->
|
||||||
|
Conf0 = <<BaseConf/binary, Conf/binary>>,
|
||||||
|
{ok, ConfMap0} = hocon:binary(Conf0, #{format => richmap}),
|
||||||
|
ConfList = hocon_tconf:generate(emqx_conf_schema, ConfMap0),
|
||||||
|
Kernel = proplists:get_value(kernel, ConfList),
|
||||||
|
Loggers = proplists:get_value(logger, Kernel),
|
||||||
|
?assertMatch(
|
||||||
|
{handler, default, logger_disk_log_h, #{
|
||||||
|
config := #{max_no_files := Count}
|
||||||
|
}},
|
||||||
|
lists:keyfind(logger_disk_log_h, 3, Loggers)
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
[{to_bin(Format, [1]), 1}, {to_bin(Format, [128]), 128}]),
|
||||||
|
lists:foreach(fun({Conf, Count}) ->
|
||||||
|
Conf0 = <<BaseConf/binary, Conf/binary>>,
|
||||||
|
{ok, ConfMap0} = hocon:binary(Conf0, #{format => richmap}),
|
||||||
|
?assertThrow({emqx_conf_schema,
|
||||||
|
[#{kind := validation_error,
|
||||||
|
mismatches := #{"handler_name" :=
|
||||||
|
#{kind := validation_error,
|
||||||
|
path := "log.file.default.rotation_count",
|
||||||
|
reason := #{expected_type := "1..128"},
|
||||||
|
value := Count}
|
||||||
|
}}]},
|
||||||
|
hocon_tconf:generate(emqx_conf_schema, ConfMap0))
|
||||||
|
end, [{to_bin(Format, [0]), 0}, {to_bin(Format, [129]), 129}]).
|
||||||
|
|
||||||
%% erlfmt-ignore
|
%% erlfmt-ignore
|
||||||
-define(BASE_AUTHN_ARRAY,
|
-define(BASE_AUTHN_ARRAY,
|
||||||
"""
|
"""
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -72,7 +72,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
# in conflict by emqtt and hocon
|
# in conflict by emqtt and hocon
|
||||||
{:getopt, "1.0.2", override: true},
|
{:getopt, "1.0.2", override: true},
|
||||||
{:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "1.0.8", override: true},
|
{:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "1.0.8", override: true},
|
||||||
{:hocon, github: "emqx/hocon", tag: "0.39.5", override: true},
|
{:hocon, github: "emqx/hocon", tag: "0.39.6", override: true},
|
||||||
{:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.5.2", override: true},
|
{:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.5.2", override: true},
|
||||||
{:esasl, github: "emqx/esasl", tag: "0.2.0"},
|
{:esasl, github: "emqx/esasl", tag: "0.2.0"},
|
||||||
{:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"},
|
{:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"},
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
, {system_monitor, {git, "https://github.com/ieQu1/system_monitor", {tag, "3.0.3"}}}
|
, {system_monitor, {git, "https://github.com/ieQu1/system_monitor", {tag, "3.0.3"}}}
|
||||||
, {getopt, "1.0.2"}
|
, {getopt, "1.0.2"}
|
||||||
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "1.0.8"}}}
|
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "1.0.8"}}}
|
||||||
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.39.5"}}}
|
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.39.6"}}}
|
||||||
, {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.2"}}}
|
, {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.2"}}}
|
||||||
, {esasl, {git, "https://github.com/emqx/esasl", {tag, "0.2.0"}}}
|
, {esasl, {git, "https://github.com/emqx/esasl", {tag, "0.2.0"}}}
|
||||||
, {jose, {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.11.2"}}}
|
, {jose, {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.11.2"}}}
|
||||||
|
|
Loading…
Reference in New Issue