Migrating should be step by step. In each module where need to use logger - need to use -include_lib("kernel/include/logger.hrl"). for including macroses like LOG from otp/logger.hrl at OTP-24.2.1 · erlang/otp · GitHub, then you can use it like:
lager:
lager:info("Invalid CSV file, could not fetch line with column defs (is there a LF or CR at the end?)"),
logger:
...
-include_lib("kernel/include/logger.hrl").
...
?LOG(info, "Invalid CSV file, could not fetch line with column defs (is there a LF or CR at the end?)"),
And don’t need to forgot add kernel into *app.src.
Also you can create/add/remove/replace custom handlers use API of logger.
More info Erlang -- logger.
It looks like exometer_core and jsxrecord are the only deps mentioned by https://hex.pm over which we don’t have control. Both don’t seem to use in in their core, or even start lager.
Personally was not hit but his, but since you are saying that lager removes only default handler, would it be feasible to use a dedicated handler for your logs then?
What I did for the migration was to first create my own logger.hrl that forwarded all macros to the respective lager:<level>() calls. Then I migrated all code gradually (subsystem-wise) to use those macros, and now the header is essentially just loading the OTP logger.hrl. It’s a bit annoying that logger and lager are not nicely interoperable, but this way worked for me.
I decided to go the brute force approach, and am replacing lager calls with the logger macros (like @vkatsuba told) everywhere and also eradicating lager from our dependencies.