HttpLogDetailLevel Enum
- java.
lang. Object - java.
lang. Enum - com.
azure. core. http. policy. HttpLogDetailLevel
- com.
- java.
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);
Fields
BASIC |
Logs only URLs, HTTP methods, and time to finish the request. |
BODY |
Logs everything in BASIC, plus all the request and response body. |
BODY_AND_HEADERS |
Logs everything in HEADERS and BODY. |
HEADERS |
Logs everything in BASIC, plus all the request and response headers. |
NONE |
Logging is turned off. |
Methods inherited from java.lang.Enum
Methods inherited from java.lang.Object
Methods
shouldLogBody()
public boolean shouldLogBody()
Whether a body should be logged.
Returns
shouldLogHeaders()
public boolean shouldLogHeaders()
Whether headers should be logged.
Returns
shouldLogUrl()
public boolean shouldLogUrl()
Whether a URL should be logged.