public static void logRequestHeadersAndQueryParams(HttpServletRequest request, Logger logger) {
    if (logger != null) {
      StringBuilder builder;

      builder = new StringBuilder();
      builder.append("\n##### HEADERS #######");
      Enumeration<String> headerNames = request.getHeaderNames();
      while (headerNames.hasMoreElements()) {
        String name = headerNames.nextElement();
        Enumeration<String> values = request.getHeaders(name);
        while (values.hasMoreElements()) {
          String value = values.nextElement();
          builder.append("\n\t");
          builder.append(name);
          builder.append(" = ");
          builder.append(value);
        }
      }
      builder.append("\n#####################");
      builder.append("\n##### PARAMETERS ####");
      MultiValueMap<String, String> queryParams = getQueryStringParameters(request);
      if (queryParams != null) {
        for (Map.Entry<String, List<String>> entry : queryParams.entrySet()) {
          String name = entry.getKey();
          List<String> values = entry.getValue();
          for (String value : values) {
            builder.append("\n\t");
            builder.append(name);
            builder.append(" = ");
            builder.append(value);
          }
        }
      }
      builder.append("\n#####################");

      logger.info(builder.toString());
    }
  }
Posts an informational message the the supplied {@link Logger} showing the request headers and
query parameters
<p>
For example:
<pre>
##### HEADERS ########
X-Requested-By = ambari
...
Accept-Encoding = gzip, deflate
Accept-Language = en-US,en;q=0.9
######################
##### PARAMETERS #####
_ = 1543700737939
######################
</pre>

@param request the {@link HttpServletRequest} to log
@param logger  the {@link Logger}
ambari-server/src/main/java/org/apache/ambari/server/utils/RequestUtils.java