axelson

axelson

Scenic Core Team

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?

Showing Posts 1 to 4

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.

axelson

axelson OP

Scenic Core Team

Okay, so on a closer inspection log: false is 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 to Ecto.LogEntry but 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

josevalim

Creator of Elixir

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

axelson OP

Scenic Core Team

Ah, I was hoping to use Ecto.UUID.cast/1, if it returned :error then 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.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
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
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
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
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews