Enum HttpLogDetailLevel

java.lang.Object
java.lang.Enum<HttpLogDetailLevel>
com.azure.core.http.policy.HttpLogDetailLevel
All Implemented Interfaces:
Serializable, Comparable<HttpLogDetailLevel>, java.lang.constant.Constable

public enum HttpLogDetailLevel extends Enum<HttpLogDetailLevel>
The HttpLogDetailLevel class is an enumeration of the levels of detail to log on HTTP messages.

This class is useful when you need to control the amount of information that is logged during the execution of HTTP requests. It provides several levels of detail, ranging from no logging at all to logging of headers and body content.

Code sample:

In this example, an HttpLogOptions is created and the log level is set to HttpLogDetailLevel.BODY_AND_HEADERS. This means that the URL, HTTP method, headers, and body content of each request and response will be logged. The HttpLogOptions is then used to create an HttpLoggingPolicy, which can then be added to the pipeline.

 HttpLogOptions logOptions = new HttpLogOptions();
 logOptions.setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS);
 HttpLoggingPolicy loggingPolicy = new HttpLoggingPolicy(logOptions);
 
See Also:
  • Enum Constant Details

    • NONE

      public static final HttpLogDetailLevel NONE
      Logging is turned off.
    • BASIC

      public static final HttpLogDetailLevel BASIC
      Logs only URLs, HTTP methods, and time to finish the request.
    • HEADERS

      public static final HttpLogDetailLevel HEADERS
      Logs everything in BASIC, plus all the request and response headers. Values of the headers will be logged only for allowed headers. See HttpLogOptions.getAllowedHeaderNames().
    • BODY

      public static final HttpLogDetailLevel BODY
      Logs everything in BASIC, plus all the request and response body. Note that only payloads in plain text or plain text encoded in GZIP will be logged.
    • BODY_AND_HEADERS

      public static final HttpLogDetailLevel BODY_AND_HEADERS
      Logs everything in HEADERS and BODY. Values of the headers will be logged only for allowed headers. See HttpLogOptions.getAllowedHeaderNames().
  • Method Details

    • values

      public static HttpLogDetailLevel[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static HttpLogDetailLevel valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • shouldLogUrl

      public boolean shouldLogUrl()
      Whether a URL should be logged.
      Returns:
      Whether a URL should be logged.
    • shouldLogHeaders

      public boolean shouldLogHeaders()
      Whether headers should be logged.
      Returns:
      Whether headers should be logged.
    • shouldLogBody

      public boolean shouldLogBody()
      Whether a body should be logged.
      Returns:
      Whether a body should be logged.