axelson
Since I’ve recently finished the main upgrade to Ecto 3.0
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
:loggersconfiguration 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?
Trending in Questions
Other Trending Topics
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
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
josevalim
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.
axelson
Okay, so on a closer inspection
log: falseis working, but I had some logging happening via a third-party on one of my repos, I had turned off that logging (via telemetry) on one of the repos, but missed another one. Sorry for the noise!While I’m here I should explain my overall goal, which is to log binary uuids as text (so
"0547838d-b356-43bb-a883-4d971f0d6fc8"instead of<<5, 71, 131, 141, 179, 86, 67, 187, 168, 131, 77, 151, 31, 13, 111, 200>>). Is that worth contributing back to Ecto? I have a commit locally that adds it toEcto.LogEntrybut since that’s being deprecated will there be a replacement that uses telemetry that is built-in to ecto? Or will that have to be provided by an external project?josevalim
Unfortunately we no longer have the information if it is UUID or a binary at the place of logging. So I am not sure about adding it to Ecto but it should be easily doable via telemetry.
axelson
Ah, I was hoping to use
Ecto.UUID.cast/1, if it returned:errorthen the data would be logged as the existing binary, but if it returned{:ok, uuid}, then it could be logged as a UUID. But I do see how that could log something as a UUID that is not actually a UUID. Maybe I could release the code as a small ecto logging library that uses telemetry.