dmitriid
{:ecto_sql, "~> 3.4"},
{:phoenix, "~> 1.5.8"},
{:phoenix_ecto, "~> 4.1"},
{:myxql, "~> 0.4.0"},
Currently Ecto is driving me crazy in development by outputting hundreds of lines of [debug] code into the console (running iex -S mix phx.server). [1] If I put log: :error into adapter config, this only makes those same hundreds of lines to output with [error]
[2]
I don’t want to disable ecto logging entirely though. If there’s an error happening, I want Ecto to log the error. I don’t think the docs cover how to do it. Do I somehow configure Telemetry to achieve what I need?
Send help! ![]()
[1]
[2]
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex












Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
RudManusachi
Those logs are just printing “query”. If error happens before query executed - you’ll see the error logged. If error happens after query executed - you’ll see both
[deug] QUERY...and the error. You could setlog: falseand only errors, are supposed to be logged anyway.John-Goff
You should set your log level in your dev.exs file. See Logger — Logger v1.12.3 and Logger — Logger v1.12.3 for more info.
03juan
Take a look at the application configuration section of the Logger docs where it describes the
:compile_time_purge_matchingoption. Find the corresponding Ecto function that’s printing the debug log, then just silence that module + function withlevel_lower_than: :infoThis is the beauty of Elixir separation of concerns that I’m still learning and coming across these great examples: instead of trying to cater for many different logging requirements by trying to configure Ecto, reconfigure at the Logger side!
03juan
Just tried my own advice and this unfortunately won’t work!
Docs say that
So I first modified my logger config to find the logging function:
That resulted in
But the
ecto_sqllibrary at line 938 invokes Logger.log/3 which warns thatI added an explicit
:debugcase option to thelog/4source code in my deps folder and recompiled as instructed withmix deps.compile ecto_sqlbut it’s still logging?config.exsHopefully someone with more experience can provide some insight
dmitriid
Thank you all for suggestions! I haven’t had the time to try them all out, I will try tomorrow!
KristerV
This has been frustrating me since I started with Elixir years ago. Kind of a crazy oversight imo. It seems that in production all SQL logs are hidden by default and that includes errors.
I’ve heard this again many times and it just doesn’t seem to be the case.
fuelen
The first thing that comes to my mind is to disable default ecto logs and provide custom handler for
[:myapp, :repo, :query]telemetry events.dmitriid
Logger configuration affects the entire application.
In this case I only want to reduce verbosity of Ecto. Because I may have my own debug calls that I want to see in the console.
dmitriid
Ok, this works, at least for me, and in my particular case.
Given
log: falsein the config, I made a deliberate error in a query (iddinstead ofid):Ecto failed and printed the following error:
No other debug logs. At this point this probably covers 99.999% of my needs.
@KristerV Give it a try. Quite possible if it wasn’t working for you it was a bug that was solved at one point.