From 85e20a62e2b986f066484147d0a15446d2699559 Mon Sep 17 00:00:00 2001
From: Akihiro Motoki <amotoki@gmail.com>
Date: Fri, 25 Feb 2022 17:14:53 +0900
Subject: [PATCH] local_settings.py: Disable django.template DEBUG messages

VariableDoesNotExist error in DEBUG messages from django.template are
super noisy. It happens even for cases where variables are not defined
like "default" filter. It also happens with Django built-in templates.
Previously we tried to fix VariableDoesNotExist errors in our templates,
but it tunrs out there is no convenient way to prevent it.

We agreed to disable django.template DEBUG messages by default
in the horizon weekly meeting [1].

Closes-Bug: #1720893

[1] https://meetings.opendev.org/meetings/horizon/2022/horizon.2022-02-23-15.00.log.html#l-105

Change-Id: Ife9a91c7cd050b30d7f1eca8861a0d6629a23827
---
 openstack_dashboard/local/local_settings.py.example | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example
index 2b084bf242..44654bc264 100644
--- a/openstack_dashboard/local/local_settings.py.example
+++ b/openstack_dashboard/local/local_settings.py.example
@@ -237,6 +237,14 @@ LOGGING = {
             'level': 'DEBUG',
             'propagate': False,
         },
+        # VariableDoesNotExist error in the debug level from django.template
+        # is VERY noisy and it is output even for valid cases,
+        # so set the default log level of django.template to INFO.
+        'django.template': {
+            'handlers': ['console'],
+            'level': 'INFO',
+            'propagate': False,
+        },
         # Logging from django.db.backends is VERY verbose, send to null
         # by default.
         'django.db.backends': {