• 
      

    Fix logging with request-related info not set up in the request.

    Review Request #11115 — Created Aug. 3, 2020 and submitted — Latest diff uploaded

    Information

    Djblets
    release-1.0.x

    Reviewers

    When a project is configured to include request-related information in a
    format string, and something logs a message before that information is
    set on the request, an exception is raised. This has occurred in various
    setups in the past. It wasn't particularly common on Django 1.6, but it
    happens any time there's a HTTP 404 on newer versions.

    We now capture this and return an empty string for the request
    information (just like we do if there's no request), avoiding this crash
    and ensuring we log something useful.

    Triggered a HTTP 404 on Django 1.11 and saw the exception raised, prior
    to this patch. After the patch, a suitable statement was logged.

    Standard logging with valid request info still works as expected.

    Commits

    Files