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

Fix logging delimiter parameterization #5003

Merged

Conversation

nunomsantos
Copy link
Contributor

@nunomsantos nunomsantos commented Mar 14, 2022

Hi all,

While reading the classes and tests for the logging feature I noticed that the code introduced in pull request #4745 to add the improvement requested on #4734 is not working as intended.
This has not been noticed by the existing tests because they were using a constructor that would not pass through the problematic code.

Currently, when registering the LoggingFeature and setting the LoggingFeature.LOGGING_FEATURE_SEPARATOR property, the empty constructor is called, which calls other constructors with nulls and so on.

Eventually we reach the constructor using a LoggingFeatureBuilder, where the arguments are set to be passed to the last constructor.
There, the builder is also set with the default separator, which later causes the following code to ignore the configuration properties on configureBuilderParameters(...) .

final String filterSeparator = CommonProperties.getValue(/* read config from properties */);
// ...
// Config read from properties is never set
builder.separator = builder.separator == null ? filterSeparator : builder.separator;

Since the builder is initially set with the default separator, it is never overridden by the configurations.
The fix is just to remove the line setting the DEFAULT_SEPARATOR on the builder before passing to the last constructor.

I guess a conversation could be had about the other configurations: anything set as non-null in the builder cannot be overridden by configurations later; but that's likely okay because those other constructors are only used in tests and the empty constructor just sets everything as null.

@nunomsantos
Copy link
Contributor Author

Hi, @jansupol. Not sure if I need to request a review but I don't see how I can do that in the UI.

@jansupol jansupol requested a review from senivam March 17, 2022 12:20
@senivam senivam merged commit db2f8a2 into eclipse-ee4j:master Mar 18, 2022
@senivam senivam added this to the 2.36 milestone Mar 18, 2022
@nunomsantos nunomsantos deleted the fix-logging-delimiter-parameterization branch March 18, 2022 15:37
This was referenced Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants