mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Format log naming
This commit is contained in:
parent
33e7cd6930
commit
a543be5f9f
@ -45,7 +45,7 @@ import static com.alibaba.nacos.api.PropertyKeyConst.*;
|
|||||||
@ConfigurationProperties("spring.cloud.nacos.discovery")
|
@ConfigurationProperties("spring.cloud.nacos.discovery")
|
||||||
public class NacosDiscoveryProperties {
|
public class NacosDiscoveryProperties {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory
|
private static final Logger log = LoggerFactory
|
||||||
.getLogger(NacosDiscoveryProperties.class);
|
.getLogger(NacosDiscoveryProperties.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -401,7 +401,7 @@ public class NacosDiscoveryProperties {
|
|||||||
namingService = NacosFactory.createNamingService(properties);
|
namingService = NacosFactory.createNamingService(properties);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
LOGGER.error("create naming service error!properties={},e=,", this, e);
|
log.error("create naming service error!properties={},e=,", this, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return namingService;
|
return namingService;
|
||||||
|
@ -33,7 +33,7 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class NacosDiscoveryClient implements DiscoveryClient {
|
public class NacosDiscoveryClient implements DiscoveryClient {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory
|
private static final Logger log = LoggerFactory
|
||||||
.getLogger(NacosDiscoveryClient.class);
|
.getLogger(NacosDiscoveryClient.class);
|
||||||
public static final String DESCRIPTION = "Spring Cloud Nacos Discovery Client";
|
public static final String DESCRIPTION = "Spring Cloud Nacos Discovery Client";
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ public class NacosDiscoveryClient implements DiscoveryClient {
|
|||||||
return services.getData();
|
return services.getData();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
LOGGER.error("get service name from nacos server fail,", e);
|
log.error("get service name from nacos server fail,", e);
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ import org.springframework.cloud.alibaba.nacos.NacosDiscoveryProperties;
|
|||||||
@Endpoint(id = "nacos-discovery")
|
@Endpoint(id = "nacos-discovery")
|
||||||
public class NacosDiscoveryEndpoint {
|
public class NacosDiscoveryEndpoint {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory
|
private static final Logger log = LoggerFactory
|
||||||
.getLogger(NacosDiscoveryEndpoint.class);
|
.getLogger(NacosDiscoveryEndpoint.class);
|
||||||
|
|
||||||
private NacosDiscoveryProperties nacosDiscoveryProperties;
|
private NacosDiscoveryProperties nacosDiscoveryProperties;
|
||||||
@ -61,7 +61,7 @@ public class NacosDiscoveryEndpoint {
|
|||||||
subscribe = namingService.getSubscribeServices();
|
subscribe = namingService.getSubscribeServices();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
LOGGER.error("get subscribe services from nacos fail,", e);
|
log.error("get subscribe services from nacos fail,", e);
|
||||||
}
|
}
|
||||||
result.put("subscribe", subscribe);
|
result.put("subscribe", subscribe);
|
||||||
return result;
|
return result;
|
||||||
|
@ -31,7 +31,7 @@ import org.springframework.util.StringUtils;
|
|||||||
*/
|
*/
|
||||||
public class NacosAutoServiceRegistration
|
public class NacosAutoServiceRegistration
|
||||||
extends AbstractAutoServiceRegistration<Registration> {
|
extends AbstractAutoServiceRegistration<Registration> {
|
||||||
private static final Logger LOGGER = LoggerFactory
|
private static final Logger log = LoggerFactory
|
||||||
.getLogger(NacosAutoServiceRegistration.class);
|
.getLogger(NacosAutoServiceRegistration.class);
|
||||||
|
|
||||||
private NacosRegistration registration;
|
private NacosRegistration registration;
|
||||||
@ -65,7 +65,7 @@ public class NacosAutoServiceRegistration
|
|||||||
@Override
|
@Override
|
||||||
protected void register() {
|
protected void register() {
|
||||||
if (!this.registration.getNacosDiscoveryProperties().isRegisterEnabled()) {
|
if (!this.registration.getNacosDiscoveryProperties().isRegisterEnabled()) {
|
||||||
LOGGER.debug("Registration disabled.");
|
log.debug("Registration disabled.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.registration.getPort() < 0) {
|
if (this.registration.getPort() < 0) {
|
||||||
|
@ -31,7 +31,7 @@ import org.springframework.util.StringUtils;
|
|||||||
*/
|
*/
|
||||||
public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(NacosServiceRegistry.class);
|
private static final Logger log = LoggerFactory.getLogger(NacosServiceRegistry.class);
|
||||||
|
|
||||||
private final NacosDiscoveryProperties nacosDiscoveryProperties;
|
private final NacosDiscoveryProperties nacosDiscoveryProperties;
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
|||||||
public void register(Registration registration) {
|
public void register(Registration registration) {
|
||||||
|
|
||||||
if (StringUtils.isEmpty(registration.getServiceId())) {
|
if (StringUtils.isEmpty(registration.getServiceId())) {
|
||||||
logger.info("No service to register for nacos client...");
|
log.info("No service to register for nacos client...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,11 +61,11 @@ public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
namingService.registerInstance(serviceId, instance);
|
namingService.registerInstance(serviceId, instance);
|
||||||
logger.info("nacos registry, {} {}:{} register finished", serviceId,
|
log.info("nacos registry, {} {}:{} register finished", serviceId,
|
||||||
instance.getIp(), instance.getPort());
|
instance.getIp(), instance.getPort());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
logger.error("nacos registry, {} register failed...{},", serviceId,
|
log.error("nacos registry, {} register failed...{},", serviceId,
|
||||||
registration.toString(), e);
|
registration.toString(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,10 +73,10 @@ public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
|||||||
@Override
|
@Override
|
||||||
public void deregister(Registration registration) {
|
public void deregister(Registration registration) {
|
||||||
|
|
||||||
logger.info("De-registering from Nacos Server now...");
|
log.info("De-registering from Nacos Server now...");
|
||||||
|
|
||||||
if (StringUtils.isEmpty(registration.getServiceId())) {
|
if (StringUtils.isEmpty(registration.getServiceId())) {
|
||||||
logger.info("No dom to de-register for nacos client...");
|
log.info("No dom to de-register for nacos client...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,11 +88,11 @@ public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
|||||||
registration.getPort(), nacosDiscoveryProperties.getClusterName());
|
registration.getPort(), nacosDiscoveryProperties.getClusterName());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
logger.error("ERR_NACOS_DEREGISTER, de-register failed...{},",
|
log.error("ERR_NACOS_DEREGISTER, de-register failed...{},",
|
||||||
registration.toString(), e);
|
registration.toString(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("De-registration finished.");
|
log.info("De-registration finished.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user