"""Download handlers for different schemes"""

import logging
from twisted.internet import defer
import six
from scrapy.exceptions import NotSupported, NotConfigured
from scrapy.utils.httpobj import urlparse_cached
from scrapy.utils.misc import load_object
from scrapy import signals


logger = logging.getLogger(__name__)


class DownloadHandlers(object):

    def __init__(self, crawler):
        self._crawler_settings = crawler.settings
        self._schemes = {}  # stores acceptable schemes on instancing
        self._handlers = {}  # stores instanced handlers for schemes
        self._notconfigured = {}  # remembers failed handlers
        handlers = crawler.settings.get('DOWNLOAD_HANDLERS_BASE')
        handlers.update(crawler.settings.get('DOWNLOAD_HANDLERS', {}))
        for scheme, clspath in six.iteritems(handlers):
            # Allow to disable a handler just like any other
            # component (extension, middleware, etc).
            if clspath is None:
                continue
            self._schemes[scheme] = clspath

        crawler.signals.connect(self._close, signals.engine_stopped)

    def _get_handler(self, scheme):
        """Lazy-load the downloadhandler for a scheme
        only on the first request for that scheme.
        """
        if scheme in self._handlers:
            return self._handlers[scheme]
        if scheme in self._notconfigured:
            return None
        if scheme not in self._schemes:
            self._notconfigured[scheme] = 'no handler available for that scheme'
            return None

        path = self._schemes[scheme]
        try:
            dhcls = load_object(path)
            dh = dhcls(self._crawler_settings)
        except NotConfigured as ex:
            self._notconfigured[scheme] = str(ex)
            return None
        except Exception as ex:
            logger.exception('Loading "{}" for scheme "{}" handler'
                             .format(path, scheme))
            self._notconfigured[scheme] = str(ex)
            return None
        else:
            self._handlers[scheme] = dh
        return self._handlers[scheme]

    def download_request(self, request, spider):
        scheme = urlparse_cached(request).scheme
        handler = self._get_handler(scheme)
        if not handler:
            raise NotSupported("Unsupported URL scheme '%s': %s" %
                               (scheme, self._notconfigured[scheme]))
        return handler.download_request(request, spider)

    @defer.inlineCallbacks
    def _close(self, *_a, **_kw):
        for dh in self._handlers.values():
            if hasattr(dh, 'close'):
                yield dh.close()

@@ -405,25 +405,16 @@
 _crawler
-_settings
  = crawl
@@ -415,25 +415,16 @@
  crawler
-.settings
 %0A       
@@ -1665,17 +1665,17 @@
 _crawler
-_
+.
 settings
@@ -1838,24 +1838,20 @@
 logger.e
-xception
+rror
 ('Loadin
@@ -1853,18 +1853,27 @@
 oading %22
-%7B%7D
+%25(clspath)s
 %22 for sc
@@ -1882,20 +1882,21 @@
 me %22
-%7B%7D%22 handler'
+%25(scheme)s%22',
 %0A   
@@ -1921,33 +1921,118 @@
     
-    .format(
+%7B%22clspath%22: 
 path, 
+%22
 scheme
-)
+%22: scheme%7D,%0A                         exc_info=True,  extra=%7B'crawler': self._crawler%7D
 )%0A  

Use log formatting and pass crawler reference