Skip to content
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

GEODE-6443: log all request and response in geode management service #3373

Merged
merged 4 commits into from Mar 29, 2019

Conversation

jinmeiliao
Copy link
Member

Thank you for submitting a contribution to Apache Geode.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typically develop)?

  • Is your initial contribution a single, squashed commit?

  • Does gradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

Note:

Please ensure that once the PR is submitted, check Concourse for build issues and
submit an update to your PR as soon as possible. If you need help, please send an
email to dev@geode.apache.org.

}
String payload = getContentAsString(wrappedRequest.getContentAsByteArray(),
wrappedRequest.getCharacterEncoding());
logger.info(String.format(requestPattern, request.getMethod(), requestUrl,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request should be logged before the filterChain.doFilter call - that way any logged errors will appear after the request in the log and the sequence of events will be correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before the filter call, the payload information is not available.

String responsePattern = "Management Response: Status=%s; response=%s";
payload = getContentAsString(wrappedResponse.getContentAsByteArray(),
wrappedResponse.getCharacterEncoding());
logger.info(String.format(responsePattern, response.getStatus(), payload));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this payload ends up with a bunch of newlines. Can you strip those out so we only log a single message line? Having multiple log lines (for a single entry) will mess up any log scraping that someone might do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -64,14 +61,8 @@ public void checkRequestsAreLogged() throws Exception {
RegionConfig regionConfig = new RegionConfig();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a start for the appender otherwise it ends up with some weird ERROR lines in the log - I thought I had done that when I originally wrote this, but I guess not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@jinmeiliao
Copy link
Member Author

flaky test failure not related to this PR

@jinmeiliao jinmeiliao merged commit 458e39b into apache:develop Mar 29, 2019
@jinmeiliao jinmeiliao deleted the log branch March 29, 2019 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants