axelson

axelson

Scenic Core Team

How do you disable logging in Ecto 3.0.7?

Since I’ve recently finished the main upgrade to Ecto 3.0 :tada: I’m now working on related updates. Since Ecto.LogEntry is soft deprecated in 3.0 (and will be fully deprecated in 3.1) I want to replace usage of it now. It seems that the way to go is to disable the built-in logging and build my own logging using the telemetry api:

  • [Ecto.Repo] The :loggers configuration is deprecated in favor of “Telemetry Events”

However, when I try to disable the built-in logging by setting my :loggers configuration to an empty list, the ecto logs are still printing out to the console when I run mix phx.server.

This is what my configuration looks like:

config :my_app, MyApp.Repo,
  loggers: []

Environment:

  • Elixir: 1.8.1
  • Erlang: 21.2
  • Ecto: 3.0.7

Edit:

After forcing a recompile of my repo I do see the following warning:

the :loggers configuration for MyApp.Repo is deprecated.
* To customize the log level, set log: :debug | :info | :warn | :error instead
* To disable logging, set log: false instead
* To hook into logging events, see the \"Telemetry Events\" section in Ecto.Repo docs

However, even adding config :my_app, MyApp.Repo, log: false I still cannot disable the built-in logging. Am I missing anything?

First Post!

josevalim

josevalim

Creator of Elixir

If log: false is not working, then that’s a bug. Please report it to the ecto_sql repo.

EDIT: although I just tried setting log: false and it worked in a local project using Ecto 3.0.

Where Next?

Popular in Questions Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement