-
Notifications
You must be signed in to change notification settings - Fork 3
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
Configuration at runtime? #4
Comments
|
@bortzmeyer Regarding the configuration I suggest looking into "mix releases" (https://hexdocs.pm/mix/1.14.4/Mix.Tasks.Release.html). You can have a config/runtime.exs that reads from environment variables. As to seeing 'beam.smp' as the log entry tag I suspect this is being set by your log collector. The logger plugin does not itself fetch the OS process name when it writes to the Unix socket. See https://github.com/pma/logger_syslog_backend/blob/master/lib/logger_syslog_backend.ex#L119. Can you share what is you log collector? rsyslog, syslog-ng? and what version? I don't get that result, but maybe I'm using a different collector or version. |
The log collector is systemd. |
|
The logger backend https://hex.pm/packages/ex_syslogger can do it, through its configuration parameter |
Changing the backend config after starting the application can be done with Logger.configure_backend/2 Logger.configure_backend({LoggerSyslogBackend, :syslog}, app_id: :new_name) |
logger_syslog_backend writes the log entry according to the format specified in RFC3164 (https://www.rfc-editor.org/rfc/rfc3164). I'm not familiar with systemd as a collector and don't know if and how it handles this format. I'm only familiar with rsyslog and syslog-ng. I took a quick look at ex_syslogger code and it seems to write in either a custom format or JSON. If you can investigate how systemd handles rfc3164 and rfc5424 and determine if it handles rfc5424 better than rfc3164, I can invest some time adding support for a 2nd format set via a configuration option. Or feel free to create a pull request to better support systemd. I'll gladly review it and push a new release to hex.pm. |
I'm not happy with
config.exs
1) because I don't want users to edit Elixir code, but configuration files in TOML / YAML / etc 2) because I want to change the configuration after the initial startup, for instance from arguments on the command-line. So, I'm looking for a way to configure at runtime.Application.put_env(:logger, …
raises no error but changes nothing, probably because the logging system already started and does not change. Is there another way?The text was updated successfully, but these errors were encountered: