-
-
Notifications
You must be signed in to change notification settings - Fork 40
Add tracing
's EnvFilter
-like log filtering with PHILOMENA_LOG
env var
#495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tracing
's EnvFilter
-like log filtering with PHILOMENA_LOG env vartracing
's EnvFilter
-like log filtering with PHILOMENA_LOG
env var
a9a2c43
to
53352ae
Compare
docker-compose.yml
Outdated
# event's module and function. The last entry in the list of filters should | ||
# be a bare `level` which will be used as a catch-all for all other log | ||
# events that do not match any of the previous filters. | ||
- PHILOMENA_LOG=${PHILOMENA_LOG-Ecto=none,Exq=none,PhilomenaMedia.Objects=info,debug} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not log ecto? i often resort to seeing the exact SQL executed to see where i screwed up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default - SQL logging is just extremely noisy, but anyway I can keep it on by default if you insist.
To explain my thinking for the long term:
My reason to disable it by default is that I found them extremely noisy, but anyway I can't do anything with that in the terminal. Terminal is too limited for working with logs at large.
My long-term wish is to send logs to Loki and view them in Grafana where it's easy to have a brids-eye view on the general state of the app via a dashboard like this. (this is a screenshot from my Telegram bot that uses Grafana, Loki, VictoriaMetrics):
From this view you can quickly see the general metrics, and the last panic / error / warning logs.
Then you can drill down into the gory details of the logs using the LogQL syntax, narrow it down by time and request span IDs.
Then expand the details of every log event you are interested in
This way there is no noise by default, it's convenient to view logs, and debug any request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've rebased this branch since it's been rather old. I pushed a single commit new change a94c676 to set ecto logging level to debug
. Everything else is the same
53352ae
to
a94c676
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You seem to have refactored philomena_media/objects.ex in this PR, please pull that out to a separate PR, as a change like this isn't within the scope of a simple logging change.
a94c676
to
df5d948
Compare
Moved the S3 changes to #570 |
…nv var (#495) * Add `tracing`'s `EnvFilter`-like log filtering with `PHILOMENA_LOG` env var * Add logs about thumbnails generation * Better comment * Remove nesting via `with` * Use `debug` logging level for ecto by default as per Meow
…nv var (philomena-dev#495) * Add `tracing`'s `EnvFilter`-like log filtering with `PHILOMENA_LOG` env var * Add logs about thumbnails generation * Better comment * Remove nesting via `with` * Use `debug` logging level for ecto by default as per Meow
Before you begin
I've been debugging way too many things with the #481, and the lack of the logs has been a really big problem. I haven't found a good way to configure filtering the logs from different modules and third-party libraries dynamically with Elixir's logger, so I rolled my own solution with the
PHILOMENA_LOG
env var.Also had to add more logs to some places to see what's actually happening there. For example, there was a bug in
s3-proxy
with uploading large files, but the error wasn't properly logged, now it is:You can enable debug logging in the
Objects
module like this:And then see these logs:

As for the thumbnail generation logs - without them I would never know that my
valkey
job queue was completely full with a bunch of duplicate thumbnail generation jobs, and that I needed to clean it up manually.