Reputation: 1672
I tried to set ecto log level to :info and added these lines in my Repo configuration according to docs:
config :app, App.Repo,
loggers: [
{Ecto.LogEntry, :log, [:info]}
]
However what i see in logs is:
[debug] QUERY OK db=5.1ms
INSERT INTO ...
It's clear that it had no effect.
I also tried adding a custom module:
ecto_inspector.ex:
defmodule App.EctoInspector do def log(log) do IO.inspect(log) log end end
config.exs:
loggers: [ {App.EctoInspector, :log, []} ]
Has something changed about the way logging is configured but not updated in docs?
I use Ecto v2.2.8
Upvotes: 0
Views: 623
Reputation: 121010
As stated in the documentation:
This option is processed at compile-time and may also be given as an option to use
Ecto.Repo
.
Emphasis is mine. Changing your config.exs
file won’t trigger Ecto
re-build. One might achieve the desired behaviour either by passing this option to use App.Repo
:
use App.Repo, loggers: [{Ecto.LogEntry, :log, [:info]}]
or by forcing Ecto
rebuild with mix do: clean, deps.compile
(or mix deps.compile --force ecto
to recompile Ecto
only, credits to Sascha Wolf.)
Upvotes: 1