'Override the tornado logging method.
If everything goes well, log level is DEBUG.
Otherwise it\'s WARNING or ERROR depending on the response code.'

def log_request(self, handler):

    if (handler.get_status() < 400):
        log_method = log.debug
    elif (handler.get_status() < 500):
        log_method = log.warning
    else:
        log_method = log.error
    request_time = (1000.0 * handler.request.request_time())
    log_method(u'%d    %s    %.2fms', handler.get_status(), handler._request_summary(), request_time)
