• 
      

    Fix support for request= keyword arguments for logging statements.

    Review Request #8750 — Created Feb. 15, 2017 and submitted

    Information

    Djblets
    release-0.9.x
    098cc31...

    Reviewers

    For a long time now, Djblets has provided support for providing a Django
    HTTP request to logging statements through a request= keyword argument.
    This has generally worked, but some users have encountered somewhat
    sporadic problems with this. This turns out to be related to our move to
    using logging.exception() instead of logging.error(..., exc_info=True)
    in places.

    logging.exception() was missing support for keyword arguments on
    Python 2.6.x, 2.7.0-2.7.5, 3.0.x, and 3.1.x. 2.7.6+ and 3.2.x+ fixed
    this, but anyone running an older version would not be able to use
    request= or even extra=.

    Along with this, any custom loggers from logging.getLogger('...')
    would fail to support request=, because we only patched up the root
    logger.

    This change fixes these issues by patching any versions of
    logging.exception() that are missing keyword argument support, and
    wrapping logging.Logger so all loggers will benefit from request=.

    Unit tests passed on Python 2.6 and 2.7. Previously, these new tests
    failed on 2.6.

    Sanity-checked that exception logs (and others) worked with request=.

    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          djblets/log/__init__.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          djblets/log/__init__.py
      
      
    2. 
        
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-0.8.x (6c2e1c1)