Nebo15 / logger_json

JSON logger formatter with support for Google Cloud, DataDog and other for Elixir.

Home Page:https://nebo15.github.io/logger_json/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use json logging for mix ecto.migrate

hawksight opened this issue · comments

I was wondering if anyone else was also using mix ecto.migrate within the application to run migrations on the database before starting the application?

Problem is that no matter what I configure, because the application is not loaded up for mix tasks the config.exs I guess it not read and the mix task just logs with default settings (I'm assuming).

I've done some research and this seems to be my issue... but I cannot find a solution out of the issues:
elixir-ecto/ecto#2038
elixir-ecto/ecto#2225

Just want to keep consistent application logs and hoping someone has a pattern in order to get the migration logs into json (preferably using this library).

@hawksight we are using code similar to this one - https://hexdocs.pm/distillery/1.3.4/running-migrations.html#migration-module and start :logger_json manually, which solves the issue. I'm not sure how do you force it's start for mix apps, especially because mix is usually trimmed from releases.

Closing as idle, please message if this question is still valid or if you have a solution (somebody else might get here looking for it).