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

Refactor YamlLoggingRuleConfigurationSwapper to add getDefaultLoggingRuleConfiguration #24728

Closed
zhfeng opened this issue Mar 22, 2023 · 3 comments · Fixed by #24729
Closed

Comments

@zhfeng
Copy link
Contributor

zhfeng commented Mar 22, 2023

Feature Request

For English only, other languages will not be accepted.

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot make decision by current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Is your feature request related to a problem?

It is simiar with #24727 and related to logback. I need to re-write DefaultLoggingRuleConfiguration in native building.

Describe the feature you would like.

Add getDefaultLoggingRuleConfiguration in YamlLoggingRuleConfigurationSwapper like

private LoggingRuleConfiguration getDefaultLoggingRuleConfiguration() {
    return new DefaultLoggingRuleConfigurationBuilder().build();
}

and change

if (null == result.getLoggers()) {
result = new DefaultLoggingRuleConfigurationBuilder().build();
}
with

if (null == result.getLoggers()) { 
    result = getDefaultLoggingRuleConfiguration();
}
zhfeng added a commit to zhfeng/sharding-sphere that referenced this issue Mar 22, 2023
@RaigorJiang
Copy link
Contributor

Hi @zhfeng
It seems that it just extracts a call into an independent method.
What is the difference between these two ways for native building?

@zhfeng
Copy link
Contributor Author

zhfeng commented Mar 22, 2023

@RaigorJiang yeah, I can use @Substitute in GraalVM and it could re-write these codes during the native building. Because I need to exclude ch.qos.logback, there are some issue with DefaultLoggingRuleConfigurationBuilder during the static analysis.

@TargetClass(YamlLoggingRuleConfigurationSwapper.class)
final class YamlLoggingRuleConfigurationSwapperSubstitution {
    @Substitute
    private LoggingRuleConfiguration getDefaultLoggingRuleConfiguration() {
        return new JBossLoggingRuleConfigurationBuilder().build();
    }
}

Then it only impacts the native image.

@RaigorJiang
Copy link
Contributor

@zhfeng OK, thanks for your answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants