I’m trying to configure my logger in the system.config file. I have {config, <path_to_file>} in shell configuration in rebar.config. However, this configuration is related to kernel, so it is not consulted before kernel starts. Currently, workaround is to call logger:reconfigure() after shell startup. I tried calling reconfiguration in script_file that evaluates before booting shell, but environment from config is not loaded yet.
Is there any way to configure logger at shell startup directly via system.config?
EDIT: If the handler’s id is /= default it succeeds… If I try to replace the default one, I must call reconfiguration.
Erlang version: 25.1
Rebar3 version: 3.19.0
Solution is to prepend {handler, default, undefined} to the configuration. But according to the docs:
**{handler, HandlerId, Module, HandlerConfig}**
If HandlerId is default, then this entry modifies the default handler, equivalent to calling
[ logger:remove_handler(default) ](https://www.erlang.org/doc/man/logger.html#remove_handler-1)
followed by
[ logger:add_handler(default, Module, HandlerConfig) ](https://www.erlang.org/doc/man/logger.html#add_handler-3)
For all other values of HandlerId, this entry adds a new handler, equivalent to calling
[ logger:add_handler(HandlerId, Module, HandlerConfig) ](https://www.erlang.org/doc/man/logger.html#add_handler-3)
Multiple entries of this type are allowed.