From cca27d1a5a909c609626547851f024d2d6f024cb Mon Sep 17 00:00:00 2001 From: terry-xiaoyu <506895667@qq.com> Date: Mon, 5 Nov 2018 16:04:58 +0800 Subject: [PATCH] Change filesync_repeat_interval to no_repeat --- priv/emqx.schema | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/priv/emqx.schema b/priv/emqx.schema index b867c4059..85a3c9581 100644 --- a/priv/emqx.schema +++ b/priv/emqx.schema @@ -464,27 +464,30 @@ end}. #{level => TopLogLevel, config => FileConf(cuttlefish:conf_get("log.file", Conf)), formatter => Formatter, - filesync_repeat_interval => 1000}}]; + filesync_repeat_interval => no_repeat}}]; true -> [] end, %% For creating additional log files for specific log levels. AdditionalLogFiles = - if LogTo =:= file orelse LogTo =:= both -> - lists:filter(fun({K, V}) -> - cuttlefish_variable:is_fuzzy_match(K, string:tokens("log.$level.file", ".")) - end, Conf); - true -> [] - end, + lists:foldl( + fun({[_, Level, _] = K, Filename}, Acc) when LogTo =:= file; LogTo =:= both -> + case cuttlefish_variable:is_fuzzy_match(K, ["log", "$level", "file"]) of + true -> [{Level, Filename} | Acc]; + false -> Acc + end; + ({_K, _V}, Acc) -> + Acc + end, [], Conf), AdditionalHandlers = [{handler, list_to_atom("file_for_"++Level), logger_disk_log_h, #{level => list_to_atom(Level), config => FileConf(Filename), formatter => Formatter, - filesync_repeat_interval => 1000}} - || {[_, Level, _], Filename} <- AdditionalLogFiles], + filesync_repeat_interval => no_repeat}} + || {Level, Filename} <- AdditionalLogFiles], - _AllHandlers = DefaultHandler ++ FileHandler ++ AdditionalHandlers + DefaultHandler ++ FileHandler ++ AdditionalHandlers end}. %%--------------------------------------------------------------------