Log a request received by a server.
@deprecated Use {@link #logServerRequest(HttpLogEntry)} instead.
345098
@Deprecated
  public static void logServerRequest(Logger logger, HttpLogEntry entry) {
    log(logger, SERVER, entry);
  }
101133
public void startLogging(RequestLogger logger) {
    ResourceServices services = getServices();
    if (services != null)
      services.startLogging(logger);
  }
1338463
@RequestMapping
    public void doLogout(HttpServletRequest request, HttpServletResponse response)
            throws IOException {

        String redirect = this.selectRedirectionUrl(request);
        final HttpSession session = request.getSession(false);

        if (session != null) {
            // Record that an authenticated user is requesting to log out
            try {
                final IPerson person = personManager.getPerson(request);
                if (person != null && person.getSecurityContext().isAuthenticated()) {
                    this.portalEventFactory.publishLogoutEvent(request, this, person);
                }
            } catch (final Exception e) {
                logger.error(
                        "Exception recording logout " + "associated with request " + request, e);
            }

            final String originalUid = this.identitySwapperManager.getOriginalUsername(session);
            // Logging out from a swapped user, just redirect to the Login servlet
            if (originalUid != null) {
                redirect = request.getContextPath() + "/Login";
            } else {
                // Clear out the existing session for the user
                try {
                    session.invalidate();
                } catch (final IllegalStateException ise) {
                    // IllegalStateException indicates session was already invalidated.
                    // This is fine.  LogoutController is looking to guarantee the logged out
                    // session is invalid;
                    // it need not insist that it be the one to perform the invalidating.
                    if (logger.isTraceEnabled()) {
                        logger.trace(
                                "LogoutController encountered IllegalStateException invalidating a presumably already-invalidated session.",
                                ise);
                    }
                }
            }
        }

        if (logger.isTraceEnabled()) {
            logger.trace(
                    "Redirecting to " + redirect + " to send the user back to the guest page.");
        }

        final String encodedRedirectURL = response.encodeRedirectURL(redirect);
        response.sendRedirect(encodedRedirectURL);
    }
776230
def LogHttpAdminUIAccess(self, request, response):
    
    # TODO(user): generate event_id elsewhere and use it for all the log
    # messages that have to do with handling corresponding request.
    event_id = self.GetNewEventId()

    api_method = response.headers.get("X-API-Method", "unknown")
    api_reason = response.headers.get("X-GRR-Reason", "none")
    log_msg = "%s API call [%s] by %s (reason: %s): %s [%d]" % (
        event_id, api_method, request.user, api_reason, request.full_path,
        response.status_code)
    logging.info(log_msg)

    if response.headers.get("X-No-Log") != "True":
      if data_store.RelationalDBEnabled():
        entry = rdf_objects.APIAuditEntry.FromHttpRequestResponse(
            request, response)
        data_store.REL_DB.WriteAPIAuditEntry(entry)
554508
def log_request(self, code='-', size='-'):
        """"""
        print_size = getattr(thread_local, 'size', -1)
        if size != '-':
            size_str = ' (%s)' % size
        elif print_size >= 0:
            size_str = self.log_size_string(print_size) + ' '
        else:
            size_str = ''
        if not self.server.suppress_noise or (code != 200 and code != 304):
            self.log_message(
                '%s"%s" %s', size_str, self.requestline, str(code))
        if print_size >= 0:
            thread_local.size = -1
243515
static void logInfo(final HttpQuery query, final String msg) {
    LOG.info(query.channel().toString() + ' ' + msg);
  }
1011183
@Deprecated
    public static void logDebug(String tag, String message, Throwable t) {
        LogManager.d(t, tag, message);
    }
861576
protected function logRequest(Request $request)
    {
        $this->logger->log(LogLevel::DEBUG, '> '.$request->getMethod().' '.$request->getRequestUri());
    }
1159104
def log_request(_, request, *_args, **_kwargs):
    # type: (Any, ClientRequest, str, str) -> None
    
    if not _LOGGER.isEnabledFor(logging.DEBUG):
        return

    try:
        _LOGGER.debug("Request URL: %r", request.url)
        _LOGGER.debug("Request method: %r", request.method)
        _LOGGER.debug("Request headers:")
        for header, value in request.headers.items():
            if header.lower() == 'authorization':
                value = '*****'
            _LOGGER.debug("    %r: %r", header, value)
        _LOGGER.debug("Request body:")

        # We don't want to log the binary data of a file upload.
        if isinstance(request.body, types.GeneratorType):
            _LOGGER.debug("File upload")
        else:
            _LOGGER.debug(str(request.body))
    except Exception as err:  # pylint: disable=broad-except
        _LOGGER.debug("Failed to log request: %r", err)
995123
def _log_request(request):
    """"""
    logger.debug("Inbound email received")

    for k, v in list(request.POST.items()):
        logger.debug("- POST['%s']='%s'" % (k, v))

    for n, f in list(request.FILES.items()):
        logger.debug("- FILES['%s']: '%s', %sB", n, f.content_type, f.size)
522709
protected void logRequest(String logMessage, MessageContext messageContext, boolean incoming) throws TransformerException {
        if (messageContext.getRequest() instanceof SoapMessage) {
            logSoapMessage(logMessage, (SoapMessage) messageContext.getRequest(), incoming);
        } else {
            logWebServiceMessage(logMessage, messageContext.getRequest(), incoming);
        }
    }
144662
def log_request(self, handler):
        
        packet = {'method': handler.request.method,
                  'uri': handler.request.uri,
                  'remote_ip': handler.request.remote_ip,
                  'status': handler.get_status(),
                  'request_time_ms': handler.request.request_time() * 1000.0,
                  'service_id': self.service_id,
                  'request_id': handler.request.headers.get(REQUEST_ID_HEADER,
                                                            'undefined')
                  }

        # handler can optionally define additional data to log
        if hasattr(handler, 'logvalues'):
            for key, value in handler.logvalues.iteritems():
                packet[key] = value

        servicelog.log(packet)

        metric = "requests." + str(handler.get_status())
        metrics.timing(metric, handler.request.request_time() * 1000.0)

        super(LoggingApplication, self).log_request(handler)
803866
private static void debug(String header, HttpResponse response) {
	if (logger.isTraceEnabled()) {
	    logger.trace(header);
	    logger.trace(response.toString());
	}
    }
725732
def log_request(self, code='-', size='-'):
        
        LOG.info("%r %s %s", self.requestline, code, size)
1351812
@Override
  public boolean proxyLoginHandler(String target, HttpServletRequest request, HttpServletResponse response) throws IOException {
    if (! isLoginTarget(target)) {
      return false;
    }

    if (isPageRequest(request)) {
      proxySendLoginForm(response);
    } else {
      response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Access denied. Please login.");
    }
    return true;
  }
1239178
@Deprecated
    protected final void requirePOST() throws ServletException {
        StaplerRequest req = Stapler.getCurrentRequest();
        if (req==null)  return; // invoked outside the context of servlet
        String method = req.getMethod();
        if(!method.equalsIgnoreCase("POST"))
            throw new ServletException("Must be POST, Can't be "+method);
    }
870936
public static void logRequest(
            Logger logger, RequestLog log, LogLevel requestLogLevel,
            Function<? super HttpHeaders, ? extends HttpHeaders> requestHeadersSanitizer,
            Function<Object, ?> requestContentSanitizer,
            Function<? super HttpHeaders, ? extends HttpHeaders> requestTrailersSanitizer) {

        if (requestLogLevel.isEnabled(logger)) {
            requestLogLevel.log(logger, REQUEST_FORMAT,
                                log.toStringRequestOnly(requestHeadersSanitizer, requestContentSanitizer,
                                                        requestTrailersSanitizer));
        }
    }