Skip to content

Commit

Permalink
Merge branch 'develop' into force_shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
terry-xiaoyu committed May 7, 2019
2 parents 25ce875 + b4c659f commit 98da807
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions etc/emqx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ log.file = emqx.log
## Limits the total number of characters printed for each log event.
##
## Value: Integer
## Default: 1024
log.chars_limit = 1024
## Default: 8192
log.chars_limit = 8192

## Maximum size of each log file.
##
Expand Down
10 changes: 3 additions & 7 deletions priv/emqx.schema
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ end}.
{datatype, {enum, [debug, info, notice, warning, error, critical, alert, emergency, all]}}
]}.

{mapping, "log.primary_level", "emqx.primary_log_level", [
{mapping, "log.primary_level", "kernel.primary_log_level", [
{default, error},
{datatype, {enum, [debug, info, notice, warning, error, critical, alert, emergency, all]}}
]}.
Expand All @@ -420,8 +420,8 @@ end}.
{datatype, file}
]}.

{mapping, "log.chars_limit", "log.chars_limit", [
{default, 1024},
{mapping, "log.chars_limit", "kernel.logger", [
{default, 8192},
{datatype, integer}
]}.

Expand Down Expand Up @@ -462,10 +462,6 @@ end}.
hidden
]}.

{translation, "emqx.primary_log_level", fun(Conf) ->
cuttlefish:conf_get("log.level", Conf)
end}.

{translation, "kernel.logger", fun(Conf) ->
LogTo = cuttlefish:conf_get("log.to", Conf),
LogLevel = cuttlefish:conf_get("log.level", Conf),
Expand Down
2 changes: 1 addition & 1 deletion src/emqx_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ start(_Type, _Args) ->
%% kernel config `logger_level` before starting the erlang vm.
%% This is because the latter approach an annoying debug msg will be printed out:
%% "[debug] got_unexpected_message {'EXIT',<0.1198.0>,normal}"
logger:set_primary_config(level, application:get_env(emqx, primary_log_level, error)),
logger:set_primary_config(level, application:get_env(kernel, primary_log_level, error)),

print_banner(),
ekka:start(),
Expand Down
11 changes: 8 additions & 3 deletions src/emqx_stats.erl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
-define(PUBSUB_STATS, [
'topics/count',
'topics/max',
'suboptions/count',
'suboptions/max',
'subscribers/count',
'subscribers/max',
'subscriptions/count',
Expand Down Expand Up @@ -242,9 +244,12 @@ code_change(_OldVsn, State, _Extra) ->
%%------------------------------------------------------------------------------

safe_update_element(Key, Val) ->
try ets:update_element(?TAB, Key, {2, Val})
try ets:update_element(?TAB, Key, {2, Val}) of
false ->
ets:insert_new(?TAB, {Key, Val});
true ->
true
catch
error:badarg ->
ets:insert_new(?TAB, {Key, Val})
?LOG(warning, "[Stats] Update ~p to ~p failed", [Key, Val])
end.

0 comments on commit 98da807

Please sign in to comment.