Closed paulo-ferraz-oliveira closed 2 years ago
I just prepared to commit the following comment to the above code in our project. :)
%% See https://github.com/erlang-lager/lager/issues/557
%% There are different ways to ensure that the log root is a stable
%% absolute path (once initialized). This could also be done using
%% sys.config.src (e.g. `{log_root, "${ROOTDIR}/log"}`, but at the time
%% of writing, `rebar3 ct` doesn't support `sys_config_src`, and it gets messy
%% to support both types.
%%
%% This setup hook code will likely run after lager has started, but it still
%% fixes the log root for later. One possible scenario might be that someone
%% pecks around in an aeternity node shell, changes the current working directory
%% and forgets to restore it. This would effectively move the logical log_root
%% in lager, if the setting is a relative path (which is the default).
%%
As per a recent discussion with @uwiger, on Slack,
lager
could be doing something like:as a way to "lock" the log root to an absolute path. This makes for easier debugging, as a call to
application:get_env(lager, log_root)
would immediately tell us where the log is in the disk.@mrallen1, @Vagabond, thoughts?