summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-11-05 13:30:31 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-12 17:04:48 +0000
commit990fb9ed6cc8414e9a0b1baed8990261650af1db (patch)
tree1ed10c5bc93660fe6727ae014a85997c44f811db /bitbake/lib/toaster
parent3e9fc8d0916f1d51dd6b748fff966d8aafd7f438 (diff)
downloadpoky-990fb9ed6cc8414e9a0b1baed8990261650af1db.tar.gz
bitbake: toaster: SQL query logging
We add a logger, enabled through the settings.py, that logs all SQL queries, with timestamp and duration, to console. This is helpful in profiling the SQL queries. The facility is disabled by default. (Bitbake rev: 54fd0a76fa3154adfab5688ecc96963f42cded11) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r--bitbake/lib/toaster/toastermain/settings.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index 42581f2df4..8de3b52f34 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -24,6 +24,10 @@
24DEBUG = True 24DEBUG = True
25TEMPLATE_DEBUG = DEBUG 25TEMPLATE_DEBUG = DEBUG
26 26
27# Set to True to see the SQL queries in console
28SQL_DEBUG = False
29
30
27ADMINS = ( 31ADMINS = (
28 # ('Your Name', 'your_email@example.com'), 32 # ('Your Name', 'your_email@example.com'),
29) 33)
@@ -276,11 +280,21 @@ LOGGING = {
276 '()': 'django.utils.log.RequireDebugFalse' 280 '()': 'django.utils.log.RequireDebugFalse'
277 } 281 }
278 }, 282 },
283 'formatters': {
284 'datetime': {
285 'format': 'DB %(asctime)s %(message)s'
286 }
287 },
279 'handlers': { 288 'handlers': {
280 'mail_admins': { 289 'mail_admins': {
281 'level': 'ERROR', 290 'level': 'ERROR',
282 'filters': ['require_debug_false'], 291 'filters': ['require_debug_false'],
283 'class': 'django.utils.log.AdminEmailHandler' 292 'class': 'django.utils.log.AdminEmailHandler'
293 },
294 'console': {
295 'level': 'DEBUG',
296 'class': 'logging.StreamHandler',
297 'formatter': 'datetime',
284 } 298 }
285 }, 299 },
286 'loggers': { 300 'loggers': {
@@ -292,6 +306,13 @@ LOGGING = {
292 } 306 }
293} 307}
294 308
309if DEBUG and SQL_DEBUG:
310 LOGGING['loggers']['django.db.backends'] = {
311 'level': 'DEBUG',
312 'handlers': ['console'],
313 }
314
315
295# If we're using sqlite, we need to tweak the performance a bit 316# If we're using sqlite, we need to tweak the performance a bit
296from django.db.backends.signals import connection_created 317from django.db.backends.signals import connection_created
297def activate_synchronous_off(sender, connection, **kwargs): 318def activate_synchronous_off(sender, connection, **kwargs):