Skip to content

Commit

Permalink
fix toolkit-common-logging config bug (#1178)
Browse files Browse the repository at this point in the history
* raise SofaConfigSourceSupportListener order to "LoggingApplicationListener.DEFAULT_ORDER - 10" to fix toolkit-common-logging config bug

* fix toolkit-common-logging config bug

---------

Co-authored-by: 寻芳 <dengjialin.djl@antgroup.com>
  • Loading branch information
crazysaltfish and 寻芳 committed May 30, 2023
1 parent 123b3eb commit 74a991d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {

@Override
public int getOrder() {
// Must be invoked after ConfigFileApplicationListener
return Ordered.HIGHEST_PRECEDENCE + 20;
// Must be invoked after ConfigFileApplicationListener, and before SofaConfigSourceSupportListener
return Ordered.HIGHEST_PRECEDENCE + 12;
}

private void prepare(ConfigurableEnvironment environment) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.alipay.sofa.common.config.SofaConfigs;
import com.alipay.sofa.common.config.source.AbstractConfigSource;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.boot.context.logging.LoggingApplicationListener;
import org.springframework.context.ApplicationListener;
import org.springframework.core.Ordered;
import org.springframework.core.env.ConfigurableEnvironment;
Expand All @@ -33,7 +34,7 @@ public class SofaConfigSourceSupportListener
implements
ApplicationListener<ApplicationEnvironmentPreparedEvent>,
Ordered {
private static final int SOFA_BOOT_CONFIG_SOURCE_ORDER = LOWEST_PRECEDENCE;
private static final int SOFA_BOOT_CONFIG_SOURCE_ORDER = LoggingApplicationListener.DEFAULT_ORDER - 5;

@Override
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
Expand Down Expand Up @@ -63,6 +64,6 @@ public boolean hasKey(String key) {

@Override
public int getOrder() {
return LOWEST_PRECEDENCE;
return LoggingApplicationListener.DEFAULT_ORDER - 5;
}
}

0 comments on commit 74a991d

Please sign in to comment.