xsteve
I have a deployed Phoenix LiveView App.
When I start it with a shell, I see output like this:
10:43:25.306 request_id=F_xtup9AcaphOX8AAEvB [info] GET /some-page/
10:43:25.312 request_id=F_xtup9AcaphOX8AAEvB [info] Sent 200 in 6ms
10:46:14.756 [info] CONNECTED TO Phoenix.LiveView.Socket in 42µs
Transport: :websocket
Serializer: Phoenix.Socket.V2.JSONSerializer
Parameters: %{“_csrf_token” => “…”, “_live_referer” => “undefined”, “_mounts” => “0”, “_track_static” => %{“0” => “webpage.com”, “1” => “webpage.com”}, “vsn” => “2.0.0”}
How to configure (turn off) this messages?
Is there a drawback when I turn these off? Do I miss some important stuff?
Can the debug levels be tweaked in the shell at runtime?
Trending in Questions
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
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
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
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
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
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
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New
Other Trending Topics
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 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
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
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
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
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
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
slouchpie
I am not at my computer but read this: Phoenix.Logger — Phoenix v1.8.8
Search that page for the word “level”
xsteve
I changed endpoint.ex like this:
socket “/live”, Phoenix.LiveView.Socket,
websocket: [connect_info: [session: @session_options], log: false],
longpoll: [connect_info: [session: @session_options], log: false]
The CONNECTED TO Phoenix.LiveView.Socket message is gone.
However the request_id lines are still present. How to find out where they are coming from and how to disable them?
slouchpie
I strongly suggest using
log: :warninginstead oflog: false.You will want to see warning/error/alert/critical/emergency level logs. Hopefully they never happen but you will definitely want to see when they do.
I am not sure where the other logs come from. If I get some free time this week, I will dig into it.
Update: I was wrong about
log: :warning. This actually changes the level of the logs printed! That is, logs which are normally:infoare now:warning.slouchpie
To get rid of the logs with the
request_idmetadata in them, do something like thisThat lives in endpoint.ex. You should already have this plug in there.
slouchpie
You can have more control over which routes get logged by using an
MFA(module-function-arity) tuple.This would do the usual logging except for paths
/health,/healthz, etc.xsteve
Thanks. That looks nice.
What is a good way to make the log_level runtime configurable?
I’d like to switch e.g. from :info to false. Therefore I need some state for the log_level function.
xsteve
Exactly - I experimented with the :info, :warning settings.
I changed it to :debug. That way they should not be longer printed in the deployed version.
Here is some info about logging in elixir:
https://staknine.com/logging-in-elixir-with-logger/