-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LogLevel Hooks to HttpLogOptions and HttpLoggingPolicy #16088
Add LogLevel Hooks to HttpLogOptions and HttpLoggingPolicy #16088
Conversation
…t and response logging
…for custom logging strategies to be passed into HttpLoggingPolicy
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLogOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpRequestLogger.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpResponseLogger.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpRequestLogger.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpResponseLogger.java
Outdated
Show resolved
Hide resolved
… a default interface method, removed defaultLogLevel from HttpLogOptions
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLogOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLogOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpRequestLogger.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpResponseLogger.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpRequestLogger.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpResponseLogger.java
Outdated
Show resolved
Hide resolved
…uest or response, made HttpPipelineCallContext's Context property accessible via getContext
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpRequestLoggingOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpResponseLoggingOptions.java
Outdated
Show resolved
Hide resolved
…azure-sdk-for-java into AzCore_AddHttpLoggingHooks
Merging ConnectedVMwarevSphere changes from azure-rest-api-specs-pr private repo... (Azure#16088) * Merging connectedvmware swagger from pr branch * minor updates * minor update * fixing lint warnings * updates * sync latest from private repo * copy examples from private repo
Fixes #11477
This PR adds two new interfaces
HttpRequestLogger
andHttpResponseLogger
to handle logging requests and responses inHttpLoggingPolicy
. The interfaces function similarly where they have a method that determines the logging level for a request/response and a method that logs the request/response if theClientLogger
is capable of logging at the expected logging level.HttpLogOptions
has been updated with two new getters and setters to configure theHttpRequestLogger
andHttpResponseLogger
that will be used byHttpLoggingPolicy
. Each property will have a default if it isn't set which is the current logic thatHttpLoggingPolicy
uses,LogLevel.INFORMATIONAL
for default log level and its implementation functions for logging requests and responses.With the new changes
HttpLoggingPolicy
can be configured to log with specific goals in mind, the following are a few scenarios:When responses take longer than expected to return the log level for the response can be escalated. For example, if the response takes more than 5 seconds to return it will be logged at the warning level, if the response takes more than 15 seconds to return it will be logged at the error level.
You have a nightly job which copies log files from your application servers and performs processing on the logs. This requires specific information to be logged in a well known format. The request and response logging functions can be customized to ensure the logging format complies with the processing requirements.