def process_response(self, request, response):

        """
        Write to the access log (in Apache/NCSA Combined Log format).

        This is a port of the Splunk web_access logging code. It is a rough
        mapping of request objects in the splunk web cherrypy server to equivalent
        objects in the django environment 
        """
        atoms = {'h': request.META.get('REMOTE_ADDR', ''),# or REMOTE_HOST
                 'l': '-',
                 'u': getattr(request, 'user', '-'),
                 't': self.access_time(time.time()), #TODO: splunkweb uses cherrypy.serving.response.time
                 'r': "%s %s %s" % (request.method, 
                                    request.get_full_path(), 
                                    request.META.get('SERVER_PROTOCOL', '')), #or ACTUAL_SERVER_PROTOCOL
                 's': response.status_code,
                 'b': len(response.content) or '-',
                 'f': request.META.get('HTTP_REFERER', ''),
                 'a': request.META.get('HTTP_USER_AGENT', ''),
                 }

        for k, v in atoms.items():
            if isinstance(v, unicode):
                v = v.encode('utf8')
            elif not isinstance(v, str):
                v = str(v)
            # Fortunately, repr(str) escapes unprintable chars, \n, \t, etc
            # and backslash for us. All we have to do is strip the quotes.
            v = repr(v)[1:-1]
            # Escape double-quote.
            atoms[k] = v.replace('"', '\\"')

        try:
            #TODO: add a response id and time here?
            self.access_logger.info(atoms % self.access_log_format)
        except:
            error_logger.log("Error writing access log")
            self(traceback=true)

        return response
dataset/ETHPy150Open splunk/splunk-webframework/server/splunkdj/middlewares.py/SplunkDjangoRequestLoggingMiddleware.process_response/swapped operands of `%`