[perf-web] Improve debugging configuration
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perf-web] Improve debugging configuration
- Date: Tue, 23 Sep 2014 14:02:33 +0000 (UTC)
commit 5605f1c389bdb3ea7766ee6b5db27bb05de23e53
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Mon Sep 22 15:25:17 2014 -0400
Improve debugging configuration
Move DEBUG to local_settings.py
Changing logging configuration so backtraces processing requests are logged
to the console.
Add LOG_SQL to local_settings.py to log SQL statements to the console.
perf/local_settings.py.sample | 6 ++++++
perf/settings.py | 37 +++++++++++++++++++++----------------
2 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/perf/local_settings.py.sample b/perf/local_settings.py.sample
index 17ff58e..6fe1063 100644
--- a/perf/local_settings.py.sample
+++ b/perf/local_settings.py.sample
@@ -15,3 +15,9 @@ DATABASES = {
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
+
+# This must be set to False in production
+DEBUG = False
+
+# If True, all SQL statements will be logged to the console
+LOG_SQL = False
diff --git a/perf/settings.py b/perf/settings.py
index 1aeb93f..b13641a 100644
--- a/perf/settings.py
+++ b/perf/settings.py
@@ -8,7 +8,6 @@ import metrics.config
MODULE_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
@@ -19,7 +18,9 @@ MANAGERS = ADMINS
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.4/ref/settings/#allowed-hosts
-ALLOWED_HOSTS = []
+# 10.0.2.101 is used in the HWTestSimulator configuration to forward
+# to a test instance of perf.gnome.org.
+ALLOWED_HOSTS = ['perf.gnome.org', '10.0.2.101', '127.0.0.1']
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
@@ -121,32 +122,35 @@ INSTALLED_APPS = (
'metrics'
)
-# A sample logging configuration. The only tangible logging
-# performed by this configuration is to send an email to
-# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
- 'disable_existing_loggers': False,
- 'filters': {
- 'require_debug_false': {
- '()': 'django.utils.log.RequireDebugFalse'
- }
+ 'disable_existing_loggers': True,
+ 'formatters': {
+ 'simple': {
+ 'format': '%(levelname)s %(asctime)s %(message)s'
+ },
},
'handlers': {
- 'mail_admins': {
- 'level': 'ERROR',
- 'filters': ['require_debug_false'],
- 'class': 'django.utils.log.AdminEmailHandler'
- }
+ 'console':{
+ 'level': 'DEBUG',
+ 'class': 'logging.StreamHandler',
+ 'formatter': 'simple'
+ },
},
+ # Log backtraces when processing requests to the console
'loggers': {
'django.request': {
- 'handlers': ['mail_admins'],
+ 'handlers': ['console'],
'level': 'ERROR',
'propagate': True,
},
+ 'django.db.backends': {
+ 'handlers': ['console'],
+ 'level': 'DEBUG' if LOG_SQL else 'ERROR',
+ 'propagate': True,
+ },
}
}
@@ -161,3 +165,4 @@ except Exception:
traceback.print_exc()
raise
+LOG_ROOT = os.path.join(MODULE_ROOT, 'logs')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]