Allow different log level for django.template

Debug log from the django.template is known to be too verbose. Recently
the sample local_settings.py in Horizon repo has been updated to
disable debug log from this module[1].

This change follows that decision and keep the default INFO log level
even when log_level='DEBUG' is set. Users are still able to enable
debug log from this module by setting the new django_template_log_level
parameter.

[1] 85e20a62e2b986f066484147d0a15446d2699559

Related-Bug: #1720893
Change-Id: I9c301db691da4adce1b9f6c40b7a3583e7e8a6f5
This commit is contained in:
Takashi Kajinami 2022-04-10 14:19:16 +09:00
parent 8fc13bfb64
commit af06fa976a
3 changed files with 18 additions and 0 deletions

View File

@ -138,6 +138,10 @@
# (optional) Log level of django module. This overrides log_level.
# Defaults to undef
#
# [*django_template_log_level*]
# (optional) Log level of django.template module.
# Defaults to 'INFO'
#
# [*syslog_facility*]
# (optional) Syslog facility used when syslog log hander is enabled.
# Defaults to 'local1'.
@ -572,6 +576,7 @@ class horizon(
$log_handlers = ['file'],
$log_level = 'INFO',
$django_log_level = undef,
$django_template_log_level = 'INFO',
$syslog_facility = 'local1',
$help_url = 'http://docs.openstack.org',
$local_settings_template = 'horizon/local_settings.py.erb',

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``horizon::django_template_log_level`` parameter has been added.
This parameter controls log level of the ``django.template`` module.

View File

@ -846,6 +846,14 @@ LOGGING = {
'level': '<%= @django_log_level_real %>',
'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': '<%= @django_template_log_level %>',
'propagate': False,
},
# Logging from django.db.backends is VERY verbose, send to null
# by default.
'django.db.backends': {