-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix template error for elixir-enabled applications. #4256
Conversation
Thanks for fixing it! |
Bad news: after applying your patch, ejabberd fails to log messages when used stand-alone. Apparently, ejabberd uses Elixir's Logger.Formatter, which uses I've done a very simple test with ejabberd 24.06, and your patch is not needed at all:
mix new myapp
cd myapp
vim mix.exs
defp deps do
[
{:ejabberd, "~> 24.6"},
]
end
mix deps.get
mix compile
wget https://raw.githubusercontent.com/processone/ejabberd/master/ejabberd.yml.example
mv ejabberd.yml.example ejabberd.yml
mix
2024-07-15 12:26:35.493 [info] Loading configuration from ejabberd.yml
2024-07-15 12:26:35.985 [info] Creating Mnesia ram table 'route'
...
2024-07-15 12:26:36.400 [info] ejabberd 24.6.0 is started in the node :nonode@nohost in 0.93s
2024-07-15 12:26:36.429 [info] Start accepting TLS connections at [::]:5223 for :ejabberd_c2s
... I'll have to revert this PR as it is now.
How did you integrate ejabberd into your elixir application? Maybe your application, or some dependency, is changing the logger configuration from Elixir's one to OTP's one? Can you provide a minimal example that allows to reproduce your problem? It would be great if your specific scenario can be detected when ejabberd is starting in console_template, and set the proper log template strings for your specific case. |
Yes, if you take the example you currently have and instead do mix release
./_build/dev/rel/myapp/bin/myapp start This would reproduce the issue. It only seems to occur during a release which makes me wonder if it has something to do with application startup order (i.e. erlang logger starts before Elixir.Logger?). I'm new to Elixir so I'm not entirely sure how it comes together along with the Erlang libraries.. |
This fixes recent commmit 090a8e3
Aha! Now I could reproduce the problem. I've added a small fix that works great for me, both in standard ejabberd start methods, and also works using the method you described. Can you try it and confirm it's fixed? Either apply the change yourself, or download the raw file and replace it. |
Awesome, yes just tested this out and it seems to work. Thank you! |
This fixes recent commmit 090a8e3
Hello, I have an Elixir-based app that is pulling ejabberd as a dependency and noticed when I run the app as a release, the console logs are missing the messages:
I realized that there is a bug in the template that uses
message
when it needs to bemsg
(as seen in the Erlang documentation https://www.erlang.org/doc/apps/kernel/logger_formatter#t:template/0)After making this change, I get the following, correct logs: