refactor: optimize log (#1671)

pull/1674/head
shedfreewu 1 month ago committed by GitHub
parent 691113c1b5
commit 0fd28d28cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -6,4 +6,5 @@
- [fix: fix ConfigChangeListener and unit test](https://github.com/Tencent/spring-cloud-tencent/pull/1657) - [fix: fix ConfigChangeListener and unit test](https://github.com/Tencent/spring-cloud-tencent/pull/1657)
- [fix: fix ConfigChangeListener ut bug](https://github.com/Tencent/spring-cloud-tencent/pull/1663) - [fix: fix ConfigChangeListener ut bug](https://github.com/Tencent/spring-cloud-tencent/pull/1663)
- [fix: tsf 2024 related bugfixes](https://github.com/Tencent/spring-cloud-tencent/pull/1664) - [fix: tsf 2024 related bugfixes](https://github.com/Tencent/spring-cloud-tencent/pull/1664)
- [fix: remove conflict dependencies management](https://github.com/Tencent/spring-cloud-tencent/pull/1669) - [fix: remove conflict dependencies management](https://github.com/Tencent/spring-cloud-tencent/pull/1669)
- [refactor: optimize log](https://github.com/Tencent/spring-cloud-tencent/pull/1671)

@ -118,7 +118,7 @@ public class MetadataContext extends com.tencent.polaris.metadata.core.manager.M
.getProperties("spring.application.name", null)); .getProperties("spring.application.name", null));
} }
if (!StringUtils.hasText(serviceName)) { if (!StringUtils.hasText(serviceName)) {
LOG.error("service name should not be blank. please configure spring.cloud.polaris.service or " LOG.warn("service name should not be blank. please configure spring.cloud.polaris.service or "
+ "spring.cloud.polaris.discovery.service or spring.application.name"); + "spring.cloud.polaris.discovery.service or spring.application.name");
} }
serviceName = DiscoveryUtil.rewriteServiceId(serviceName); serviceName = DiscoveryUtil.rewriteServiceId(serviceName);

@ -59,7 +59,7 @@ public class ApplicationContextAwareUtils implements ApplicationContextAware {
if (applicationContext != null) { if (applicationContext != null) {
return applicationContext.getEnvironment().getProperty(key); return applicationContext.getEnvironment().getProperty(key);
} }
LOGGER.warn("applicationContext is null, try to get property from System.getenv or System.getProperty"); LOGGER.warn("applicationContext is null, try to get property({}} from System.getenv or System.getProperty", key);
String property = System.getenv(key); String property = System.getenv(key);
if (StringUtils.isBlank(property)) { if (StringUtils.isBlank(property)) {
property = System.getProperty(key); property = System.getProperty(key);
@ -77,7 +77,7 @@ public class ApplicationContextAwareUtils implements ApplicationContextAware {
if (applicationContext != null) { if (applicationContext != null) {
return applicationContext.getEnvironment().getProperty(key, defaultValue); return applicationContext.getEnvironment().getProperty(key, defaultValue);
} }
LOGGER.warn("applicationContext is null, try to get property from System.getenv or System.getProperty"); LOGGER.warn("applicationContext is null, try to get property({}} from System.getenv or System.getProperty", key);
String property = System.getenv(key); String property = System.getenv(key);
if (StringUtils.isBlank(property)) { if (StringUtils.isBlank(property)) {
property = System.getProperty(key, defaultValue); property = System.getProperty(key, defaultValue);

Loading…
Cancel
Save