Skip to content
Browse files
fix logger reset for the shell plugin
The shell plugin has to reset the logger by fetching its configuration and
re-applying it later. In the current state, `maybe_reset_logger/1` will only
re-apply part of the configuration (the `config` key), which does not include
other settings such as filters and formatters.

The effect can be demonstrated by adding filters or formatters to `~/.erlang`
and running rebar3 shell on any project (without any --config argument, this
one reload the logger env; updating the kernel/logger environment in
`~/.erlang` fixes it).

For example:
logger:set_handler_config(default, #{formatter => {logger_formatter,
                                                   #{template => ["> ", msg, "\n"]}}}).

This patch makes sure the default handler is re-created with its entire
original configuration.
  • Loading branch information
galdor committed Nov 15, 2020
1 parent e43dd6b commit 89de8551f0ec1304dd6e7aec40ec4b1afcab7f83
Showing 1 changed file with 2 additions and 2 deletions.
@@ -171,8 +171,8 @@ maybe_remove_logger() ->

maybe_reset_logger(ignore) ->
maybe_reset_logger({restart, #{module := Mod, config := Cfg}}) ->
logger:add_handler(default, Mod, Cfg).
maybe_reset_logger({restart, Config = #{module := Mod}}) ->
logger:add_handler(default, Mod, Config).

kill_old_user() ->
OldUser = whereis(user),

0 comments on commit 89de855

Please sign in to comment.