Skip to content
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

Allow silencing of web access logs #2273

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AndrewKvalheim
Copy link
Contributor

Changedetection.io currently emits web access logs on stderr that don’t respect LOGGER_LEVEL:

  $ podman run --rm --publish '5000:5000' --env LOGGER_LEVEL='INFO' changedetection.io
  2024-03-22 20:40:40.116 | INFO     | changedetectionio.store:__init__:45 - Datastore path is '/datastore/url-watches.json'
  2024-03-22 20:40:40.116 | CRITICAL | changedetectionio.store:__init__:91 - No JSON DB found at /datastore/url-watches.json, creating JSON store at /datastore
  2024-03-22 20:40:40.117 | INFO     | changedetectionio.store:sync_to_json:420 - Saving JSON..
  2024-03-22 20:40:40.117 | INFO     | changedetectionio.store:sync_to_json:420 - Saving JSON..
  2024-03-22 20:40:40.119 | INFO     | changedetectionio.store:sync_to_json:420 - Saving JSON..
┃ (1) wsgi starting up on http://0.0.0.0:5000
  2024-03-22 20:40:41.150 | INFO     | changedetectionio.update_worker:run:248 - Processing watch UUID bc68db9c-cef9-43f8-ad4a-76689ed70484 Priority 1711140040 URL https://news.ycombinator.com/
  2024-03-22 20:40:41.151 | INFO     | changedetectionio.update_worker:run:248 - Processing watch UUID 7346370b-6d30-4c3f-8ddf-1d14de324931 Priority 1711140040 URL https://changedetection.io/CHANGELOG.txt
  2024-03-22 20:40:41.414 | INFO     | changedetectionio.update_worker:run:506 - Change triggered in UUID bc68db9c-cef9-43f8-ad4a-76689ed70484 due to first history saving (no notifications sent) - https://news.ycombinator.com/
  2024-03-22 20:40:42.918 | INFO     | changedetectionio.update_worker:run:506 - Change triggered in UUID 7346370b-6d30-4c3f-8ddf-1d14de324931 due to first history saving (no notifications sent) - https://changedetection.io/CHANGELOG.txt
┃ (1) accepted ('10.0.2.100', 34698)
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET / HTTP/1.1" 200 7812 0.063777
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/styles/pure-min.css HTTP/1.1" 200 4220 0.002249
┃ (1) accepted ('10.0.2.100', 34714)
┃ (1) accepted ('10.0.2.100', 34716)
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/styles/styles.css?v=0.45.16 HTTP/1.1" 200 8674 0.001966
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/js/jquery-3.6.0.min.js HTTP/1.1" 200 32361 0.004307
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/js/toggle-theme.js HTTP/1.1" 200 1117 0.001498
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/js/watch-overview.js HTTP/1.1" 200 1182 0.001342
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/images/spread.svg HTTP/1.1" 200 1158 0.001050
┃ (1) accepted ('10.0.2.100', 34726)
┃ (1) accepted ('10.0.2.100', 34728)
┃ (1) accepted ('10.0.2.100', 34746)
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/images/bell-off.svg HTTP/1.1" 200 1634 0.001030
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/images/Google-Chrome-icon.png HTTP/1.1" 200 14886 0.000925
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/images/spread-white.svg HTTP/1.1" 200 1268 0.000839
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/images/pause.svg HTTP/1.1" 200 3297 0.000817
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/images/Generic_Feed-icon.svg HTTP/1.1" 200 989 0.001147
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/images/gradient-border.png HTTP/1.1" 200 22393 0.001131
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/js/jquery-3.6.0.min.js HTTP/1.1" 200 32361 0.002757
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/favicons/apple-touch-icon.png HTTP/1.1" 200 32336 0.001297
┃ 10.0.2.100 - - [22/Mar/2024 20:40:47] "GET /static/favicons/favicon-32x32.png HTTP/1.1" 200 14318 0.000767

My goal is to have some mechanism by which to silence the web access logs. Here I’ve offered one solution, but perhaps someone else can suggest a better one.

By default the WSGI server logs directly to stderr.
The WSGI server logs every HTTP response at level INFO, which is
inappropriately verbose. As a workaround, disable response logging at
application log levels above DEBUG.
@dgtlmoon
Copy link
Owner

dgtlmoon commented Apr 3, 2024

Hmm they are different subsystems

One is the WSGI server and one is the actual 'changedetection'

I would prefer some env var like SILENT_WSGI instead, could you do that?

@AndrewKvalheim
Copy link
Contributor Author

Something like that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants