Skip to content
Python
Find file
Latest commit d9f543b @jmoiron Merge pull request #2 from aquameta/master
Celery support for Slow Log
Failed to load latest commit information.
django_slow_log Forgot to remove connection. from query_count
docs initial commit, working logging middleware
patches Added patch for django 1.3 to modify core to include query_count
tests initial commit, working logging middleware
.gitignore initial commit, working logging middleware
LICENCE
MANIFEST.in add MANIFEST.in which includes the license and readme and will fix th…
README.rst Readme
setup.cfg get ready for initial distribution to pypi
setup.py - removed django from the requirement so it stops trying to install 1.3

README.rst

django-slow-log

django-slow-log is an additional logging layer that keeps a log similar to an apache or nginx request log, but adds additional higher level information about the state of the process and the resources used by the server during the generation of the response.

installing/usage

To use, add to your MIDDLEWARE_CLASSES in settings.py:

MIDDLEWARE_CLASSES = (
    'django_slow_log.middleware.SlowLogMiddleware',
    ...
)

There is a patch for Django 1.2.x branch that adds a query_count attribute to the postgres core connection object. This is a git patch and must be applied using git-apply. Inside a Django 1.2.x fork, use the following steps:

Take a look at the patch:

git apply --stat /path/to/slow/log/repo/patches/add_query_count_to_django_1.x_core.patch

Test the patch before applying it:

git apply --check /path/to/slow/log/repo/patches/add_query_count_to_django_1.x_core.patch

Apply the patch if there aren't errors:

git am --signoff < /path/to/slow/log/repo/patches/add_query_count_to_django_1.x_core.patch

If this patch is not applied, the queries field will be null unless django is running in DEBUG = True.

settings

DJANGO_SLOW_LOG_PRINT_ONLY
do not keep a log in a file, only print; this can be useful for use on your devbox (via runserver)
DJANGO_SLOW_LOG_LOCATION
path of the log file (default: /var/log/django-slow.log)

celery

OFFLOAD_SLOW_LOG
Defaults to False. When set to True, Django Slow Log will attempt to offload the log call to Celery. Celery must be installed to use this option. See http://celeryproject.org.
CELERY_IMPORTS
add django_slow_log.middleware to your CELERY_IMPORTS config tuple for djcelery.
Something went wrong with that request. Please try again.