mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	logging: Explain quirks of Python logging config, and apply a style.
This should make it a little easier to understand our logging config
and make changes to it with confidence.
Many of these items that are now redundant used to be required when we
were setting disable_existing_loggers to True (before 500d81bf2), in
order to exempt those loggers from being cleared out.  Now they're not.
One bit of test code needed a tweak to how it got its hands on the
AdminZulipHandler instance; it can do it from the list on the root
logger just as well as on the `django` logger.
			
			
This commit is contained in:
		@@ -109,10 +109,13 @@ else:
 | 
			
		||||
    CACHES['default'] = {
 | 
			
		||||
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
 | 
			
		||||
    }
 | 
			
		||||
    LOGGING['loggers']['zulip.requests']['level'] = 'CRITICAL'
 | 
			
		||||
    LOGGING['loggers']['zulip.management']['level'] = 'CRITICAL'
 | 
			
		||||
    LOGGING['loggers']['django.request'] = {'level': 'ERROR'}
 | 
			
		||||
    LOGGING['loggers']['fakeldap'] = {'level': 'ERROR'}
 | 
			
		||||
 | 
			
		||||
    def set_loglevel(logger_name, level):
 | 
			
		||||
        LOGGING['loggers'].setdefault(logger_name, {})['level'] = level
 | 
			
		||||
    set_loglevel('zulip.requests', 'CRITICAL')
 | 
			
		||||
    set_loglevel('zulip.management', 'CRITICAL')
 | 
			
		||||
    set_loglevel('django.request', 'ERROR')
 | 
			
		||||
    set_loglevel('fakeldap', 'ERROR')
 | 
			
		||||
 | 
			
		||||
# Enable file:/// hyperlink support by default in tests
 | 
			
		||||
ENABLE_FILE_LINKS = True
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user