你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
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
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈