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

feat: configure opt-out metada auto-population for JUL handler #807

Merged
merged 3 commits into from
Dec 23, 2021

Conversation

minherz
Copy link
Contributor

@minherz minherz commented Dec 23, 2021

Allow to opt-out auto-population of the log entries with additional metadata in JUL handler using the flag in LoggingOptions and LoggingConfig configuration.

Opt-out is set if at least one of the above will be set to false. Absence of the configuration is interpreted same as setting the configuration to true.

@minherz minherz self-assigned this Dec 23, 2021
@minherz minherz requested review from a team as code owners December 23, 2021 11:39
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: logging Issues related to the googleapis/java-logging API. labels Dec 23, 2021
@@ -417,4 +456,8 @@ private Logging getLogging() {
}
return logging;
}

private static boolean isTrueOrNull(Boolean b) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Such methods ideally should accept additional variable with default value to be returned in case if checked parameter is null.

Copy link
Contributor Author

@minherz minherz Dec 23, 2021

Choose a reason for hiding this comment

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

It is not "getter". This method is used to answer the question whether the parameter is null or Boolean.TRUE.

Copy link
Contributor

@losalex losalex Dec 23, 2021

Choose a reason for hiding this comment

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

nit: I was kinda suggesting to make it "getter", so it can be reused later if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is "getter":

public Boolean getAutoPopulateMetadata() {
return this.autoPopulateMetadata;
}

The above is a service method used at initialization only to enforce opt-out if one of the original sources of the configuration: LoggingOptions or config file has it set to FALSE. However, if the configuration is omitted then it should be interpreted as "allowed" according to the design requirement: to allow by default.

adds metadata auto-population flag to JUL handler.
adds metadata auto-population flag to logging config file.
forwards metadata auto-population flag via WriteOption to write() calls.
refactors JUL handler tests to remove duplication, unused calls and warnings
@minherz minherz merged commit a9db521 into minherz/structured_logging Dec 23, 2021
@minherz minherz deleted the minherz/799 branch December 23, 2021 19:18
minherz added a commit that referenced this pull request Dec 30, 2021
Adds metadata auto-population flag to JUL handler.
Adds metadata auto-population flag to logging config file.
Forwards metadata auto-population flag via WriteOption to write() calls.
Refactors JUL handler tests to remove duplication, unused calls and warnings
minherz added a commit that referenced this pull request Jan 4, 2022
Adds metadata auto-population flag to JUL handler.
Adds metadata auto-population flag to logging config file.
Forwards metadata auto-population flag via WriteOption to write() calls.
Refactors JUL handler tests to remove duplication, unused calls and warnings
minherz added a commit that referenced this pull request Jan 5, 2022
Adds metadata auto-population flag to JUL handler.
Adds metadata auto-population flag to logging config file.
Forwards metadata auto-population flag via WriteOption to write() calls.
Refactors JUL handler tests to remove duplication, unused calls and warnings
minherz added a commit that referenced this pull request Jan 7, 2022
…ogs redirection to stdout in JUL handler (#808)

Aggregates the following work:
- #821
- #812
- #807
- #803
- #798

Fixes #689, #691, #799 and #800

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants