diff -r bea53389c204 django/core/handlers/base.py
--- a/django/core/handlers/base.py	Tue Oct 05 01:44:12 2010 +0000
+++ b/django/core/handlers/base.py	Wed Oct 06 21:17:42 2010 +0800
@@ -1,12 +1,12 @@
-import logging
 import sys
 
 from django import http
 from django.core import signals
 from django.utils.encoding import force_unicode
 from django.utils.importlib import import_module
+from django.utils.log import getLogger
 
-logger = logging.getLogger('django.request')
+logger = getLogger('django.request')
 
 
 class BaseHandler(object):
diff -r bea53389c204 django/core/handlers/modpython.py
--- a/django/core/handlers/modpython.py	Tue Oct 05 01:44:12 2010 +0000
+++ b/django/core/handlers/modpython.py	Wed Oct 06 21:17:42 2010 +0800
@@ -1,4 +1,3 @@
-import logging
 import os
 from pprint import pformat
 import sys
@@ -10,8 +9,9 @@
 from django.core.urlresolvers import set_script_prefix
 from django.utils import datastructures
 from django.utils.encoding import force_unicode, smart_str, iri_to_uri
+from django.utils.log import getLogger
 
-logger = logging.getLogger('django.request')
+logger = getLogger('django.request')
 
 
 # NOTE: do *not* import settings (or any module which eventually imports
diff -r bea53389c204 django/core/handlers/wsgi.py
--- a/django/core/handlers/wsgi.py	Tue Oct 05 01:44:12 2010 +0000
+++ b/django/core/handlers/wsgi.py	Wed Oct 06 21:17:42 2010 +0800
@@ -1,4 +1,3 @@
-import logging
 from pprint import pformat
 import sys
 from threading import Lock
@@ -13,8 +12,9 @@
 from django.core.urlresolvers import set_script_prefix
 from django.utils import datastructures
 from django.utils.encoding import force_unicode, iri_to_uri
+from django.utils.log import getLogger
 
-logger = logging.getLogger('django.request')
+logger = getLogger('django.request')
 
 
 # See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
diff -r bea53389c204 django/db/backends/util.py
--- a/django/db/backends/util.py	Tue Oct 05 01:44:12 2010 +0000
+++ b/django/db/backends/util.py	Wed Oct 06 21:17:42 2010 +0800
@@ -1,11 +1,11 @@
 import datetime
 import decimal
-import logging
 from time import time
 
 from django.utils.hashcompat import md5_constructor
+from django.utils.log import getLogger
 
-logger = logging.getLogger('django.db.backends')
+logger = getLogger('django.db.backends')
 
 class CursorDebugWrapper(object):
     def __init__(self, cursor, db):
diff -r bea53389c204 django/middleware/common.py
--- a/django/middleware/common.py	Tue Oct 05 01:44:12 2010 +0000
+++ b/django/middleware/common.py	Wed Oct 06 21:17:42 2010 +0800
@@ -1,4 +1,3 @@
-import logging
 import re
 
 from django.conf import settings
@@ -7,8 +6,9 @@
 from django.utils.http import urlquote
 from django.core import urlresolvers
 from django.utils.hashcompat import md5_constructor
+from django.utils.log import getLogger
 
-logger = logging.getLogger('django.request')
+logger = getLogger('django.request')
 
 
 class CommonMiddleware(object):
diff -r bea53389c204 django/middleware/csrf.py
--- a/django/middleware/csrf.py	Tue Oct 05 01:44:12 2010 +0000
+++ b/django/middleware/csrf.py	Wed Oct 06 21:17:42 2010 +0800
@@ -6,7 +6,6 @@
 """
 
 import itertools
-import logging
 import re
 import random
 
@@ -14,6 +13,7 @@
 from django.core.urlresolvers import get_callable
 from django.utils.cache import patch_vary_headers
 from django.utils.hashcompat import md5_constructor
+from django.utils.log import getLogger
 from django.utils.safestring import mark_safe
 
 _POST_FORM_RE = \
@@ -21,7 +21,7 @@
 
 _HTML_TYPES = ('text/html', 'application/xhtml+xml')
 
-logger = logging.getLogger('django.request')
+logger = getLogger('django.request')
 
 # Use the system (hardware-based) random number generator if it exists.
 if hasattr(random, 'SystemRandom'):
diff -r bea53389c204 django/utils/log.py
--- a/django/utils/log.py	Tue Oct 05 01:44:12 2010 +0000
+++ b/django/utils/log.py	Wed Oct 06 21:17:42 2010 +0800
@@ -1,4 +1,5 @@
 import logging
+import sys
 from django.core import mail
 
 # Make sure a NullHandler is available
@@ -17,10 +18,32 @@
 except ImportError:
     from django.utils.dictconfig import dictConfig
 
+if sys.version_info < (2, 5):
+    class LoggerCompat(object):
+        def __init__(self, logger):
+            self._logger = logger
+
+        def __getattr__(self, name):
+            val = getattr(self._logger, name)
+            if callable(val):
+                def _wrapper(*args, **kwargs):
+                    # Python 2.4 logging module doesn't support 'extra' parameter to
+                    # methods of Logger
+                    kwargs.pop('extra', None)
+                    return val(*args, **kwargs)
+                return _wrapper
+            else:
+                return val
+
+    def getLogger(name=None):
+        return LoggerCompat(logging.getLogger(name=name))
+else:
+    getLogger = logging.getLogger
+
 # Ensure the creation of the Django logger
 # with a null handler. This ensures we don't get any
 # 'No handlers could be found for logger "django"' messages
-logger = logging.getLogger('django')
+logger = getLogger('django')
 if not logger.handlers:
     logger.addHandler(NullHandler())
 
@@ -35,7 +58,14 @@
         from django.conf import settings
 
         try:
-            request = record.request
+            if sys.version_info < (2,5):
+                # A nasty workaround required because Python 2.4's logging
+                # module doesn't support passing in extra context.
+                # For this handler, the only extra data we need is the
+                # request, and that's in the top stack frame.
+                request = record.exc_info[2].tb_frame.f_locals['request']
+            else:
+                request = record.request
 
             subject = '%s (%s IP): %s' % (
                 record.levelname,
diff -r bea53389c204 django/views/decorators/http.py
--- a/django/views/decorators/http.py	Tue Oct 05 01:44:12 2010 +0000
+++ b/django/views/decorators/http.py	Wed Oct 06 21:17:42 2010 +0800
@@ -10,16 +10,16 @@
 from calendar import timegm
 from datetime import timedelta
 from email.Utils import formatdate
-import logging
 
 from django.utils.decorators import decorator_from_middleware, available_attrs
 from django.utils.http import parse_etags, quote_etag
+from django.utils.log import getLogger
 from django.middleware.http import ConditionalGetMiddleware
 from django.http import HttpResponseNotAllowed, HttpResponseNotModified, HttpResponse
 
 conditional_page = decorator_from_middleware(ConditionalGetMiddleware)
 
-logger = logging.getLogger('django.request')
+logger = getLogger('django.request')
 
 
 def require_http_methods(request_method_list):
diff -r bea53389c204 django/views/generic/simple.py
--- a/django/views/generic/simple.py	Tue Oct 05 01:44:12 2010 +0000
+++ b/django/views/generic/simple.py	Wed Oct 06 21:17:42 2010 +0800
@@ -1,9 +1,8 @@
-import logging
-
 from django.template import loader, RequestContext
 from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
+from django.utils.log import getLogger
 
-logger = logging.getLogger('django.request')
+logger = getLogger('django.request')
 
 
 def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs):
diff -r bea53389c204 docs/topics/logging.txt
--- a/docs/topics/logging.txt	Tue Oct 05 01:44:12 2010 +0000
+++ b/docs/topics/logging.txt	Wed Oct 06 21:17:42 2010 +0800
@@ -411,6 +411,10 @@
     * ``request``: The request object that generated the logging
       message.
 
+.. note::
+    Due to a limitation in the logging library, this extra
+    context is not available if you are using Python 2.4.
+
 ``django.db.backends``
 ~~~~~~~~~~~~~~~~~~~~~~
 
@@ -424,6 +428,10 @@
     * ``sql``: The SQL statement that was executed.
     * ``params``: The parameters that were used in the SQL call.
 
+.. note::
+    Due to a limitation in the logging library, this extra
+    context is not available if you are using Python 2.4.
+
 Handlers
 --------
 
