Umbrella apps are an interesting feature of Elixir, but I'm surprised the logging by default doesn't show which app is generating a log message. I'd like to add the umbrella app's name to the Logger metadata, but I'm not sure the best place to do that. Each app can configure the logger separately it seems and whitelist which metadata to show, but I'm not sure where to add the umbrella metadata
For example in apps/web/config/dev.exs
I can put
config :logger, :console,
metadata: [:umbrella_app]
But then I'm not finding a good place to add something like Logger.metadata(umbrella_app: :web)
to populate the metadata.
Try adding :application
to metadata
config :logger, :console,
format: "$metadata[$level] $message\n",
metadata: [:application]
This will print message like this
application=app [level] Message
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.