Skip to content

Commit 1b32d18

Browse files
authored
Reduce logging of common redirects and expected items (#10497)
* Reduce logging of common redirects and expected items This should massively reduce the amount of logs we're showing: * Update common to fix lint
1 parent 7ea51c0 commit 1b32d18

File tree

6 files changed

+10
-12
lines changed

6 files changed

+10
-12
lines changed

common

Submodule common updated 1 file

readthedocs/proxito/redirects.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ def canonical_redirect(request, project, redirect_type, external_version_slug=No
7676

7777
if from_url == to:
7878
# check that we do have a response and avoid infinite redirect
79-
log.warning(
79+
log.debug(
8080
"Infinite Redirect: FROM URL is the same than TO URL.",
8181
url=to,
8282
)
8383
raise InfiniteRedirectException()
8484

85-
log.info(
85+
log.debug(
8686
"Canonical Redirect.", host=request.get_host(), from_url=from_url, to_url=to
8787
)
8888
resp = HttpResponseRedirect(to)

readthedocs/proxito/views/mixins.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def get_redirect_response(self, request, redirect_path, proxito_path, http_statu
378378
# Redirects shouldn't change the domain, version or language.
379379
# However, if the new_path is already an absolute URI, just use it
380380
new_path = request.build_absolute_uri(new_path)
381-
log.info(
381+
log.debug(
382382
'Redirecting...',
383383
from_url=request.build_absolute_uri(proxito_path),
384384
to_url=new_path,
@@ -394,7 +394,7 @@ def get_redirect_response(self, request, redirect_path, proxito_path, http_statu
394394
and new_path_parsed.path == old_path_parsed.path
395395
):
396396
# check that we do have a response and avoid infinite redirect
397-
log.warning(
397+
log.debug(
398398
'Infinite Redirect: FROM URL is the same than TO URL.',
399399
url=new_path,
400400
)

readthedocs/proxito/views/serve.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ def _get_canonical_redirect_type(self, request):
308308
.exists()
309309
)
310310
# For .com we need to check if the project supports custom domains.
311-
# pylint: disable=protected-access
312311
if canonical_domain and resolver._use_cname(project):
313312
log.debug(
314313
"Proxito Public Domain -> Canonical Domain Redirect.",
@@ -525,7 +524,6 @@ def get(self, request, proxito_path, template_name="404.html"):
525524
with the default version and finally, if none of them are found, the Read
526525
the Docs default page (Maze Found) is rendered by Django and served.
527526
"""
528-
# pylint: disable=too-many-locals
529527
log.bind(proxito_path=proxito_path)
530528
log.debug('Executing 404 handler.')
531529

@@ -691,7 +689,7 @@ def _get_custom_404_page(self, request, project, version=None):
691689
storage_root_path, tryfile
692690
)
693691
if build_media_storage.exists(storage_filename_path):
694-
log.info(
692+
log.debug(
695693
"Serving custom 404.html page.",
696694
version_slug_404=version_404.slug,
697695
storage_filename_path=storage_filename_path,

readthedocs/search/documents.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def update(self, *args, **kwargs):
2222
# Hack a fix to our broken connection pooling
2323
# This creates a new connection on every request,
2424
# but actually works :)
25-
log.info('Hacking Elastic indexing to fix connection pooling')
26-
self.using = Elasticsearch(**settings.ELASTICSEARCH_DSL['default'])
25+
log.debug("Hacking Elastic indexing to fix connection pooling")
26+
self.using = Elasticsearch(**settings.ELASTICSEARCH_DSL["default"])
2727
super().update(*args, **kwargs)
2828

2929

readthedocs/search/faceted_search.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def __init__(
6969
# Hack a fix to our broken connection pooling
7070
# This creates a new connection on every request,
7171
# but actually works :)
72-
log.info('Hacking Elastic to fix search connection pooling')
73-
self.using = Elasticsearch(**settings.ELASTICSEARCH_DSL['default'])
72+
log.debug("Hacking Elastic to fix search connection pooling")
73+
self.using = Elasticsearch(**settings.ELASTICSEARCH_DSL["default"])
7474

7575
filters = filters or {}
7676

0 commit comments

Comments
 (0)