mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
format code and change logger to log
This commit is contained in:
parent
93defa99e2
commit
ac382c9e3f
@ -11,6 +11,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>spring-cloud-alicloud-acm</artifactId>
|
||||
<name>Spring Cloud Alibaba Cloud ACM</name>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@ -43,6 +44,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
@ -33,7 +33,7 @@ import java.util.*;
|
||||
*/
|
||||
class AcmPropertySourceBuilder {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(AcmPropertySourceBuilder.class);
|
||||
private Logger log = LoggerFactory.getLogger(AcmPropertySourceBuilder.class);
|
||||
|
||||
/**
|
||||
* 传入 ACM 的 DataId 和 groupID,获取到解析后的 AcmProperty 对象
|
||||
@ -59,20 +59,23 @@ class AcmPropertySourceBuilder {
|
||||
}
|
||||
if (dataId.endsWith(".properties")) {
|
||||
Properties properties = new Properties();
|
||||
logger.info(String.format("Loading acm data, dataId: '%s', group: '%s'",
|
||||
log.info(String.format("Loading acm data, dataId: '%s', group: '%s'",
|
||||
dataId, diamondGroup));
|
||||
properties.load(new StringReader(data));
|
||||
return properties;
|
||||
} else if (dataId.endsWith(".yaml") || dataId.endsWith(".yml")) {
|
||||
}
|
||||
else if (dataId.endsWith(".yaml") || dataId.endsWith(".yml")) {
|
||||
YamlPropertiesFactoryBean yamlFactory = new YamlPropertiesFactoryBean();
|
||||
yamlFactory.setResources(new ByteArrayResource(data.getBytes()));
|
||||
return yamlFactory.getObject();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (e instanceof ConfigException) {
|
||||
logger.error("DIAMOND-100500:" + dataId + ", " + e.toString(), e);
|
||||
} else {
|
||||
logger.error("DIAMOND-100500:" + dataId, e);
|
||||
log.error("DIAMOND-100500:" + dataId + ", " + e.toString(), e);
|
||||
}
|
||||
else {
|
||||
log.error("DIAMOND-100500:" + dataId, e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -87,7 +90,8 @@ class AcmPropertySourceBuilder {
|
||||
Object value = properties.getProperty(key);
|
||||
if (value != null) {
|
||||
result.put(key, ((String) value).trim());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
result.put(key, null);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,8 @@ public class AcmHealthIndicator extends AbstractHealthIndicator {
|
||||
builder.down().withDetail(String.format("dataId: '%s', group: '%s'",
|
||||
dataId, acmProperties.getGroup()), "config is empty");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
builder.down().withDetail(String.format("dataId: '%s', group: '%s'",
|
||||
dataId, acmProperties.getGroup()), e.getMessage());
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.cloud.alicloud.acm.AcmPropertySourceRepository;
|
||||
import org.springframework.cloud.alicloud.acm.bootstrap.AcmPropertySource;
|
||||
import org.springframework.cloud.alicloud.context.acm.AcmIntegrationProperties;
|
||||
import org.springframework.cloud.context.refresh.ContextRefresher;
|
||||
import org.springframework.cloud.endpoint.event.RefreshEvent;
|
||||
@ -50,7 +49,7 @@ import com.alibaba.edas.acm.listener.ConfigChangeListener;
|
||||
public class AcmContextRefresher
|
||||
implements ApplicationListener<ApplicationReadyEvent>, ApplicationContextAware {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(AcmContextRefresher.class);
|
||||
private Logger log = LoggerFactory.getLogger(AcmContextRefresher.class);
|
||||
|
||||
private final ContextRefresher contextRefresher;
|
||||
|
||||
@ -103,7 +102,7 @@ public class AcmContextRefresher
|
||||
}
|
||||
catch (NoSuchAlgorithmException
|
||||
| UnsupportedEncodingException e) {
|
||||
logger.warn("unable to get md5 for dataId: " + dataId, e);
|
||||
log.warn("unable to get md5 for dataId: " + dataId, e);
|
||||
}
|
||||
}
|
||||
refreshHistory.add(dataId, md5);
|
||||
|
Loading…
x
Reference in New Issue
Block a user