diff --git a/spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java b/spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java index bd3edea6ac..63a87d2d04 100644 --- a/spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java +++ b/spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -243,7 +243,13 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa getCodecConfigurer(), getLocaleContextResolver(), this.applicationContext); } - private String formatRequest(ServerHttpRequest request) { + /** + * Format the request for logging purposes including HTTP method and URL. + *
By default this prints the HTTP method, the URL path, and the query. + * @param request the request to format + * @return the String to display, never empty or @code null} + */ + protected String formatRequest(ServerHttpRequest request) { String rawQuery = request.getURI().getRawQuery(); String query = StringUtils.hasText(rawQuery) ? "?" + rawQuery : ""; return "HTTP " + request.getMethod() + " \"" + request.getPath() + query + "\"";