-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Release remote console does not use application logger configuration #13749
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
Comments
Does it work if you do |
Hey @josevalim , thanks for taking a look. It does not seem to fix it, I get the same result: $ _build/prod/rel/bugapp/bin/bugapp remote
Erlang/OTP 26 [erts-14.2.2] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:1] [jit:ns]
Interactive Elixir (1.17.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(bugapp@iris)1> Application.stop(:logger)
:ok
iex(bugapp@iris)2> Application.start(:logger)
:ok
iex(bugapp@iris)3> require Logger
Logger
iex(bugapp@iris)4> Logger.info("hello")
:ok
12:29:27.669 [info] hello
iex(bugapp@iris)5> |
I found out the root cause. By default, Elixir's Logger has a clause to avoid logging anything caused by remote consoles. You can do this:
To remove said filter. I will improve the docs. |
Thanks a lot for looking into this, your solution worked. One thing I do not understand is why the remote console prints log messages to STDOUT with a different set of metadata than what is configured in the release. With I couldn't find the relevant code in the Logger application. |
The answer is based on us having two nodes and they have different configs. The node running the remote terminal does not have your application started. Just the minimum to connect to the remote node. |
Elixir and Erlang/OTP versions
Erlang/OTP 26 [erts-14.2.2] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:1] [jit:ns]
Elixir 1.17.2 (compiled with Erlang/OTP 25)
Operating system
Debian 12
Current behavior
Given an application created with
mix new bugapp
and the followingconfig/config.exs
:We build the release and start it:
Then attach a console to it:
The file
myapp.log
is created but remains empty. The log message is printed to the attached console STDOUT but not written to the file, and the formatting used is not the one specified in the configuration.This differs from starting a console directly:
In this case, the log message is written to
myapp.log
, as expected, and nothing is written to the console STDOUT.Expected behavior
The expected behavior would be for the attached/remote console to use the configured handler and formatter. I could not figure out which handler/formatter is used to display the message on STDOUT, the
Logger
documentation does not mention this behavior with releases.The text was updated successfully, but these errors were encountered: