Skip to content

Commit 89de855

Browse files
committed
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: ```erlang 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.
1 parent e43dd6b commit 89de855

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rebar_prv_shell.erl

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ maybe_remove_logger() ->
171171

172172
maybe_reset_logger(ignore) ->
173173
ok;
174-
maybe_reset_logger({restart, #{module := Mod, config := Cfg}}) ->
175-
logger:add_handler(default, Mod, Cfg).
174+
maybe_reset_logger({restart, Config = #{module := Mod}}) ->
175+
logger:add_handler(default, Mod, Config).
176176

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

0 commit comments

Comments
 (0)