com.alipay.sofa.rpc.log.Logger.infoWithApp()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(13.3k)|赞(0)|评价(0)|浏览(271)

本文整理了Java中com.alipay.sofa.rpc.log.Logger.infoWithApp()方法的一些代码示例,展示了Logger.infoWithApp()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.infoWithApp()方法的具体详情如下:
包路径:com.alipay.sofa.rpc.log.Logger
类名称:Logger
方法名:infoWithApp

Logger.infoWithApp介绍

[英]Info with app.
[中]信息与应用程序。

代码示例

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * 打印连接失败日志
  3. *
  4. * @param interfaceId 接口名称
  5. * @param providerInfo 服务端
  6. * @param transport 连接
  7. */
  8. protected void printFailure(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
  9. if (LOGGER.isInfoEnabled(consumerConfig.getAppName())) {
  10. LOGGER.infoWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} failure !", interfaceId,
  11. providerInfo);
  12. }
  13. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * 打印连接失败日志
  3. *
  4. * @param interfaceId 接口名称
  5. * @param providerInfo 服务端
  6. * @param transport 连接
  7. */
  8. protected void printFailure(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
  9. if (LOGGER.isInfoEnabled(consumerConfig.getAppName())) {
  10. LOGGER.infoWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} failure !", interfaceId,
  11. providerInfo);
  12. }
  13. }

代码示例来源:origin: alipay/sofa-rpc

  1. @Override
  2. public void unSubscribe(ConsumerConfig config) {
  3. String appName = config.getAppName();
  4. if (!registryConfig.isSubscribe()) {
  5. // 注册中心不订阅
  6. if (LOGGER.isInfoEnabled(appName)) {
  7. LOGGER.infoWithApp(appName, LogCodes.getLog(LogCodes.INFO_REGISTRY_IGNORE));
  8. }
  9. }
  10. // 注册Consumer节点
  11. if (config.isRegister()) {
  12. // 向服务器端发送取消订阅请求
  13. String url = ConsulRegistryHelper.convertConsumerToUrl(config);
  14. ConsulURL consulURL = ConsulURL.valueOf(url);
  15. consumerUrls.remove(config);
  16. notifyServiceListeners.remove(consulURL.getServiceKey());
  17. }
  18. }

代码示例来源:origin: alipay/sofa-rpc

  1. @Override
  2. public void unSubscribe(ConsumerConfig config) {
  3. String appName = config.getAppName();
  4. if (!registryConfig.isSubscribe()) {
  5. // 注册中心不订阅
  6. if (LOGGER.isInfoEnabled(appName)) {
  7. LOGGER.infoWithApp(appName, LogCodes.getLog(LogCodes.INFO_REGISTRY_IGNORE));
  8. }
  9. }
  10. // 注册Consumer节点
  11. if (config.isRegister()) {
  12. // 向服务器端发送取消订阅请求
  13. String url = ConsulRegistryHelper.convertConsumerToUrl(config);
  14. ConsulURL consulURL = ConsulURL.valueOf(url);
  15. consumerUrls.remove(config);
  16. notifyServiceListeners.remove(consulURL.getServiceKey());
  17. }
  18. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * 打印连接成功日志
  3. *
  4. * @param interfaceId 接口名称
  5. * @param providerInfo 服务端
  6. * @param transport 连接
  7. */
  8. protected void printSuccess(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
  9. if (LOGGER.isInfoEnabled(consumerConfig.getAppName())) {
  10. LOGGER.infoWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} success ! The connection is "
  11. + NetUtils.connectToString(transport.remoteAddress(), transport.localAddress())
  12. , interfaceId, providerInfo);
  13. }
  14. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * 打印连接成功日志
  3. *
  4. * @param interfaceId 接口名称
  5. * @param providerInfo 服务端
  6. * @param transport 连接
  7. */
  8. protected void printSuccess(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
  9. if (LOGGER.isInfoEnabled(consumerConfig.getAppName())) {
  10. LOGGER.infoWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} success ! The connection is "
  11. + NetUtils.connectToString(transport.remoteAddress(), transport.localAddress())
  12. , interfaceId, providerInfo);
  13. }
  14. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * 接口配置修改子节点Data
  3. *
  4. * @param config 接口配置
  5. * @param overridePath 覆盖Path
  6. * @param data 子节点Data
  7. * @throws Exception 转换配置异常
  8. */
  9. public void updateConfig(AbstractInterfaceConfig config, String overridePath, ChildData data) throws Exception {
  10. if (data == null) {
  11. if (LOGGER.isInfoEnabled(config.getAppName())) {
  12. LOGGER.infoWithApp(config.getAppName(), "Receive update data is null");
  13. }
  14. } else {
  15. if (LOGGER.isInfoEnabled(config.getAppName())) {
  16. LOGGER.infoWithApp(config.getAppName(), "Receive update data: path=[" + data.getPath() + "]" +
  17. ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]");
  18. }
  19. notifyListeners(config, overridePath, data, false, null);
  20. }
  21. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * 接口配置新增子节点Data
  3. *
  4. * @param config 接口配置
  5. * @param overridePath 覆盖Path
  6. * @param data 子节点Data
  7. * @throws Exception 转换配置异常
  8. */
  9. public void addConfig(AbstractInterfaceConfig config, String overridePath, ChildData data) throws Exception {
  10. if (data == null) {
  11. if (LOGGER.isInfoEnabled(config.getAppName())) {
  12. LOGGER.infoWithApp(config.getAppName(), "Receive data is null");
  13. }
  14. } else {
  15. if (LOGGER.isInfoEnabled(config.getAppName())) {
  16. LOGGER.infoWithApp(config.getAppName(), "Receive add data: path=[" + data.getPath() + "]" + ", data=[" +
  17. StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]");
  18. }
  19. notifyListeners(config, overridePath, data, false, null);
  20. }
  21. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * 接口配置修改子节点Data
  3. *
  4. * @param config 接口配置
  5. * @param configPath 配置Path
  6. * @param data 子节点Data
  7. */
  8. public void updateConfig(AbstractInterfaceConfig config, String configPath, ChildData data) {
  9. if (data == null) {
  10. if (LOGGER.isInfoEnabled(config.getAppName())) {
  11. LOGGER.infoWithApp(config.getAppName(), "Receive update data is null");
  12. }
  13. } else {
  14. if (LOGGER.isInfoEnabled(config.getAppName())) {
  15. LOGGER.infoWithApp(config.getAppName(), "Receive update data: path=[" + data.getPath() + "]"
  16. + ", data=[" + StringSerializer.decode(data.getData()) + "]"
  17. + ", stat=[" + data.getStat() + "]");
  18. }
  19. notifyListeners(config, configPath, data, false);
  20. }
  21. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * 接口配置修改子节点Data
  3. *
  4. * @param config 接口配置
  5. * @param overridePath 覆盖Path
  6. * @param data 子节点Data
  7. * @throws Exception 转换配置异常
  8. */
  9. public void updateConfig(AbstractInterfaceConfig config, String overridePath, ChildData data) throws Exception {
  10. if (data == null) {
  11. if (LOGGER.isInfoEnabled(config.getAppName())) {
  12. LOGGER.infoWithApp(config.getAppName(), "Receive update data is null");
  13. }
  14. } else {
  15. if (LOGGER.isInfoEnabled(config.getAppName())) {
  16. LOGGER.infoWithApp(config.getAppName(), "Receive update data: path=[" + data.getPath() + "]" +
  17. ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]");
  18. }
  19. notifyListeners(config, overridePath, data, false, null);
  20. }
  21. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * 接口配置新增子节点Data
  3. *
  4. * @param config 接口配置
  5. * @param overridePath 覆盖Path
  6. * @param data 子节点Data
  7. * @throws Exception 转换配置异常
  8. */
  9. public void addConfig(AbstractInterfaceConfig config, String overridePath, ChildData data) throws Exception {
  10. if (data == null) {
  11. if (LOGGER.isInfoEnabled(config.getAppName())) {
  12. LOGGER.infoWithApp(config.getAppName(), "Receive data is null");
  13. }
  14. } else {
  15. if (LOGGER.isInfoEnabled(config.getAppName())) {
  16. LOGGER.infoWithApp(config.getAppName(), "Receive add data: path=[" + data.getPath() + "]" + ", data=[" +
  17. StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]");
  18. }
  19. notifyListeners(config, overridePath, data, false, null);
  20. }
  21. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * Remove Provider
  3. *
  4. * @param config ConsumerConfig
  5. * @param providerPath Provider path of zookeeper
  6. * @param data Event data
  7. * @param currentData provider data list
  8. * @throws UnsupportedEncodingException decode error
  9. */
  10. public void removeProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData)
  11. throws UnsupportedEncodingException {
  12. if (LOGGER.isInfoEnabled(config.getAppName())) {
  13. LOGGER.infoWithApp(config.getAppName(),
  14. "Receive remove provider: path=[" + data.getPath() + "]" + ", data=[" +
  15. StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" +
  16. currentData.size() + "]");
  17. }
  18. notifyListeners(config, providerPath, currentData, false);
  19. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * Update Provider
  3. *
  4. * @param config ConsumerConfig
  5. * @param providerPath Provider path of zookeeper
  6. * @param data Event data
  7. * @param currentData provider data list
  8. * @throws UnsupportedEncodingException decode error
  9. */
  10. public void updateProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData)
  11. throws UnsupportedEncodingException {
  12. if (LOGGER.isInfoEnabled(config.getAppName())) {
  13. LOGGER.infoWithApp(config.getAppName(),
  14. "Receive update provider: path=[" + data.getPath() + "]" + ", data=[" +
  15. StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" +
  16. currentData.size() + "]");
  17. }
  18. notifyListeners(config, providerPath, currentData, false);
  19. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * Add provider
  3. *
  4. * @param config ConsumerConfig
  5. * @param providerPath Provider path of zookeeper
  6. * @param data Event data
  7. * @param currentData provider data list
  8. * @throws UnsupportedEncodingException decode error
  9. */
  10. public void addProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData)
  11. throws UnsupportedEncodingException {
  12. if (LOGGER.isInfoEnabled(config.getAppName())) {
  13. LOGGER.infoWithApp(config.getAppName(),
  14. "Receive add provider: path=[" + data.getPath() + "]" + ", data=[" +
  15. StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" +
  16. currentData.size() + "]");
  17. }
  18. notifyListeners(config, providerPath, currentData, true);
  19. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * Update Provider
  3. *
  4. * @param config ConsumerConfig
  5. * @param providerPath Provider path of zookeeper
  6. * @param data Event data
  7. * @param currentData provider data list
  8. * @throws UnsupportedEncodingException decode error
  9. */
  10. public void updateProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData)
  11. throws UnsupportedEncodingException {
  12. if (LOGGER.isInfoEnabled(config.getAppName())) {
  13. LOGGER.infoWithApp(config.getAppName(),
  14. "Receive update provider: path=[" + data.getPath() + "]" + ", data=[" +
  15. StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" +
  16. currentData.size() + "]");
  17. }
  18. notifyListeners(config, providerPath, currentData, false);
  19. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * Add provider
  3. *
  4. * @param config ConsumerConfig
  5. * @param providerPath Provider path of zookeeper
  6. * @param data Event data
  7. * @param currentData provider data list
  8. * @throws UnsupportedEncodingException decode error
  9. */
  10. public void addProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData)
  11. throws UnsupportedEncodingException {
  12. if (LOGGER.isInfoEnabled(config.getAppName())) {
  13. LOGGER.infoWithApp(config.getAppName(),
  14. "Receive add provider: path=[" + data.getPath() + "]" + ", data=[" +
  15. StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" +
  16. currentData.size() + "]");
  17. }
  18. notifyListeners(config, providerPath, currentData, true);
  19. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * Remove Provider
  3. *
  4. * @param config ConsumerConfig
  5. * @param providerPath Provider path of zookeeper
  6. * @param data Event data
  7. * @param currentData provider data list
  8. * @throws UnsupportedEncodingException decode error
  9. */
  10. public void removeProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData)
  11. throws UnsupportedEncodingException {
  12. if (LOGGER.isInfoEnabled(config.getAppName())) {
  13. LOGGER.infoWithApp(config.getAppName(),
  14. "Receive remove provider: path=[" + data.getPath() + "]" + ", data=[" +
  15. StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" +
  16. currentData.size() + "]");
  17. }
  18. notifyListeners(config, providerPath, currentData, false);
  19. }

代码示例来源:origin: alipay/sofa-rpc

  1. @Override
  2. public void degrade(MeasureResultDetail measureResultDetail) {
  3. InvocationStatDimension statDimension = measureResultDetail.getInvocationStatDimension();
  4. String appName = statDimension.getAppName();
  5. if (LOGGER.isInfoEnabled(appName)) {
  6. String service = statDimension.getService();
  7. long timeWindow = measureResultDetail.getTimeWindow();
  8. long windowCount = measureResultDetail.getWindowCount();
  9. double abnormalRate = measureResultDetail.getAbnormalRate();
  10. double averageAbnormalRate = measureResultDetail.getAverageAbnormalRate();
  11. String ip = statDimension.getIp();
  12. LOGGER.infoWithApp(appName,
  13. LogCodes.getLog(LogCodes.INFO_REGULATION_ABNORMAL, timeWindow, service, appName,
  14. windowCount, abnormalRate, averageAbnormalRate, ip));
  15. }
  16. }
  17. }

代码示例来源:origin: alipay/sofa-rpc

  1. @Override
  2. public void degrade(MeasureResultDetail measureResultDetail) {
  3. InvocationStatDimension statDimension = measureResultDetail.getInvocationStatDimension();
  4. String appName = statDimension.getAppName();
  5. if (LOGGER.isInfoEnabled(appName)) {
  6. String service = statDimension.getService();
  7. long timeWindow = measureResultDetail.getTimeWindow();
  8. long windowCount = measureResultDetail.getWindowCount();
  9. double abnormalRate = measureResultDetail.getAbnormalRate();
  10. double averageAbnormalRate = measureResultDetail.getAverageAbnormalRate();
  11. String ip = statDimension.getIp();
  12. LOGGER.infoWithApp(appName,
  13. LogCodes.getLog(LogCodes.INFO_REGULATION_ABNORMAL, timeWindow, service, appName,
  14. windowCount, abnormalRate, averageAbnormalRate, ip));
  15. }
  16. }
  17. }

代码示例来源:origin: alipay/sofa-rpc

  1. /**
  2. * 注册单条服务信息
  3. *
  4. * @param appName 应用名
  5. * @param serviceName 服务关键字
  6. * @param providerInfo 服务提供者数据
  7. */
  8. protected void doRegister(String appName, String serviceName, ProviderInfo providerInfo) {
  9. registerAppInfoOnce(appName);
  10. if (LOGGER.isInfoEnabled(appName)) {
  11. LOGGER.infoWithApp(appName, LogCodes.getLog(LogCodes.INFO_ROUTE_REGISTRY_PUB, serviceName));
  12. }
  13. PublishServiceRequest publishServiceRequest = new PublishServiceRequest();
  14. publishServiceRequest.setServiceName(serviceName);
  15. ProviderMetaInfo providerMetaInfo = new ProviderMetaInfo();
  16. providerMetaInfo.setProtocol(providerInfo.getProtocolType());
  17. providerMetaInfo.setSerializeType(providerInfo.getSerializationType());
  18. providerMetaInfo.setAppName(appName);
  19. providerMetaInfo.setVersion(VERSION);
  20. publishServiceRequest.setProviderMetaInfo(providerMetaInfo);
  21. client.publishService(publishServiceRequest);
  22. }

相关文章