-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undocumented logger env var #9436
Comments
The simple logger is used to capture log events before the logging infrastructure is started. Any log events that happen before the Possibly we should also add a |
Okay, that's also undocumented. If we add IMO
Hmm, only due to |
hmm, it should only replay to the
If you add a default handler the simple will/should be removed. No matter how you add it, reconfigure or add_handler.
That, and that otherwise you will loose log events which is not a good thing.
The release part is rebar3 specific and not really an Erlang/OTP thing. The documentation should state that if you set the
Yes, I agree with this. If the simple handler is still present after the release has started, an error log message should be sent saying that the system a default logger handler. I'm not 100% sure when relx calls logger:reconfigure during boot, but that check needs to be done after that call is done. |
Yeah, now I tested it properly and it replays only to the
So, I wrote a simple test for that and it seems to me that when calling -module(l).
-include_lib("stdlib/include/assert.hrl").
-export([test/0]).
test() ->
%% 1. Set env
ok = application:set_env([{kernel,
[{logger_level, notice},
{logger,
[{handler, default, undefined}]
}]
}]),
ok = logger:reconfigure(),
%% 2. Add default handler
ok = logger:add_handler(default,
logger_std_h,
#{level=>notice,
config=>
#{file=>"_log/default",
sync_mode_qlen=>0}}),
%% 3. "simple" should be removed after `add_handler(default, ...)`
?assert(not lists:member(simple, logger:get_handler_ids())).
I think I understand now - this way user can add/remove handlers after reconfiguration if handler configs are not in the |
Following to the discussion.
I thing that this behavior should be documented somewhere.
According to previous release notes,
error_logger
environment variable should be deprecated and replaced by env vars inlogger
.However, there is no environment variable for
logger
configuration that makessimple
handler to disappear.My opinion is that
simple
handler should be removed after the configuration by default - current behavior was pretty unexpected to me. If I got it correctly, the purpose ofsimple
handler is just not to loose logs while reconfiguration - I don't see simple logger being added anywhere else.I'm open to make a PR if anyone can point me what exactly should be done.
Should be just document
error_logger
env or should we change the behavior?The text was updated successfully, but these errors were encountered: