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

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

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

Logger.isDebugEnabled介绍

[英]Is debug enabled boolean.
[中]是启用调试的布尔值。

代码示例

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

  1. public SofaResteasyClientBuilder logProviders() {
  2. if (LOGGER.isDebugEnabled()) {
  3. Set pcs = getProviderFactory().getProviderClasses();
  4. StringBuilder sb = new StringBuilder();
  5. sb.append("\ndefault-providers:\n");
  6. for (Object provider : pcs) {
  7. sb.append(" ").append(provider).append("\n");
  8. }
  9. LOGGER.debug(sb.toString());
  10. }
  11. return this;
  12. }
  13. }

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

  1. public SofaResteasyClientBuilder logProviders() {
  2. if (LOGGER.isDebugEnabled()) {
  3. Set pcs = getProviderFactory().getProviderClasses();
  4. StringBuilder sb = new StringBuilder();
  5. sb.append("\ndefault-providers:\n");
  6. for (Object provider : pcs) {
  7. sb.append(" ").append(provider).append("\n");
  8. }
  9. LOGGER.debug(sb.toString());
  10. }
  11. return this;
  12. }
  13. }

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

  1. /**
  2. * 反注册一个订阅者
  3. *
  4. * @param eventClass 事件类型
  5. * @param subscriber 订阅者
  6. */
  7. public static void unRegister(Class<? extends Event> eventClass, Subscriber subscriber) {
  8. CopyOnWriteArraySet<Subscriber> set = SUBSCRIBER_MAP.get(eventClass);
  9. if (set != null) {
  10. set.remove(subscriber);
  11. if (LOGGER.isDebugEnabled()) {
  12. LOGGER.debug("UnRegister subscriber: {} of event: {}.", subscriber, eventClass);
  13. }
  14. }
  15. }

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

  1. /**
  2. * 反注册一个订阅者
  3. *
  4. * @param eventClass 事件类型
  5. * @param subscriber 订阅者
  6. */
  7. public static void unRegister(Class<? extends Event> eventClass, Subscriber subscriber) {
  8. CopyOnWriteArraySet<Subscriber> set = SUBSCRIBER_MAP.get(eventClass);
  9. if (set != null) {
  10. set.remove(subscriber);
  11. if (LOGGER.isDebugEnabled()) {
  12. LOGGER.debug("UnRegister subscriber: {} of event: {}.", subscriber, eventClass);
  13. }
  14. }
  15. }

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

  1. /**
  2. * 注册一个订阅者
  3. *
  4. * @param eventClass 事件类型
  5. * @param subscriber 订阅者
  6. */
  7. public static void register(Class<? extends Event> eventClass, Subscriber subscriber) {
  8. CopyOnWriteArraySet<Subscriber> set = SUBSCRIBER_MAP.get(eventClass);
  9. if (set == null) {
  10. set = new CopyOnWriteArraySet<Subscriber>();
  11. CopyOnWriteArraySet<Subscriber> old = SUBSCRIBER_MAP.putIfAbsent(eventClass, set);
  12. if (old != null) {
  13. set = old;
  14. }
  15. }
  16. set.add(subscriber);
  17. if (LOGGER.isDebugEnabled()) {
  18. LOGGER.debug("Register subscriber: {} of event: {}.", subscriber, eventClass);
  19. }
  20. }

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

  1. /**
  2. * 注册一个订阅者
  3. *
  4. * @param eventClass 事件类型
  5. * @param subscriber 订阅者
  6. */
  7. public static void register(Class<? extends Event> eventClass, Subscriber subscriber) {
  8. CopyOnWriteArraySet<Subscriber> set = SUBSCRIBER_MAP.get(eventClass);
  9. if (set == null) {
  10. set = new CopyOnWriteArraySet<Subscriber>();
  11. CopyOnWriteArraySet<Subscriber> old = SUBSCRIBER_MAP.putIfAbsent(eventClass, set);
  12. if (old != null) {
  13. set = old;
  14. }
  15. }
  16. set.add(subscriber);
  17. if (LOGGER.isDebugEnabled()) {
  18. LOGGER.debug("Register subscriber: {} of event: {}.", subscriber, eventClass);
  19. }
  20. }

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

  1. @Override
  2. public void onLoad(ExtensionClass<TelnetHandler> extensionClass) {
  3. // 自己维护支持列表,不托管给ExtensionLoaderFactory
  4. TelnetHandler handler = extensionClass.getExtInstance();
  5. supportedCmds.put(handler.getCommand(), handler);
  6. if (LOGGER.isDebugEnabled()) {
  7. LOGGER.debug("Add telnet handler {}:{}.", handler.getCommand(), handler);
  8. }
  9. }
  10. });

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

  1. @Override
  2. public void onLoad(ExtensionClass<TelnetHandler> extensionClass) {
  3. // 自己维护支持列表,不托管给ExtensionLoaderFactory
  4. TelnetHandler handler = extensionClass.getExtInstance();
  5. supportedCmds.put(handler.getCommand(), handler);
  6. if (LOGGER.isDebugEnabled()) {
  7. LOGGER.debug("Add telnet handler {}:{}.", handler.getCommand(), handler);
  8. }
  9. }
  10. });

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

  1. @Override
  2. public void onLoad(ExtensionClass<Filter> extensionClass) {
  3. Class<? extends Filter> implClass = extensionClass.getClazz();
  4. // 读取自动加载的类列表。
  5. AutoActive autoActive = implClass.getAnnotation(AutoActive.class);
  6. if (autoActive != null) {
  7. String alias = extensionClass.getAlias();
  8. if (autoActive.providerSide()) {
  9. PROVIDER_AUTO_ACTIVES.put(alias, extensionClass);
  10. }
  11. if (autoActive.consumerSide()) {
  12. CONSUMER_AUTO_ACTIVES.put(alias, extensionClass);
  13. }
  14. if (LOGGER.isDebugEnabled()) {
  15. LOGGER.debug("Extension of interface " + Filter.class
  16. + ", " + implClass + "(" + alias + ") will auto active");
  17. }
  18. }
  19. }
  20. });

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

  1. @Override
  2. public void onLoad(ExtensionClass<Router> extensionClass) {
  3. Class<? extends Router> implClass = extensionClass.getClazz();
  4. // 读取自动加载的类列表。
  5. AutoActive autoActive = implClass.getAnnotation(AutoActive.class);
  6. if (autoActive != null) {
  7. String alias = extensionClass.getAlias();
  8. if (autoActive.providerSide()) {
  9. PROVIDER_AUTO_ACTIVES.put(alias, extensionClass);
  10. }
  11. if (autoActive.consumerSide()) {
  12. CONSUMER_AUTO_ACTIVES.put(alias, extensionClass);
  13. }
  14. if (LOGGER.isDebugEnabled()) {
  15. LOGGER.debug("Extension of interface " + Router.class + ", " + implClass + "(" + alias +
  16. ") will auto active");
  17. }
  18. }
  19. }
  20. });

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

  1. @Override
  2. public void onLoad(ExtensionClass<Router> extensionClass) {
  3. Class<? extends Router> implClass = extensionClass.getClazz();
  4. // 读取自动加载的类列表。
  5. AutoActive autoActive = implClass.getAnnotation(AutoActive.class);
  6. if (autoActive != null) {
  7. String alias = extensionClass.getAlias();
  8. if (autoActive.providerSide()) {
  9. PROVIDER_AUTO_ACTIVES.put(alias, extensionClass);
  10. }
  11. if (autoActive.consumerSide()) {
  12. CONSUMER_AUTO_ACTIVES.put(alias, extensionClass);
  13. }
  14. if (LOGGER.isDebugEnabled()) {
  15. LOGGER.debug("Extension of interface " + Router.class + ", " + implClass + "(" + alias +
  16. ") will auto active");
  17. }
  18. }
  19. }
  20. });

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

  1. @Override
  2. public void onLoad(ExtensionClass<Filter> extensionClass) {
  3. Class<? extends Filter> implClass = extensionClass.getClazz();
  4. // 读取自动加载的类列表。
  5. AutoActive autoActive = implClass.getAnnotation(AutoActive.class);
  6. if (autoActive != null) {
  7. String alias = extensionClass.getAlias();
  8. if (autoActive.providerSide()) {
  9. PROVIDER_AUTO_ACTIVES.put(alias, extensionClass);
  10. }
  11. if (autoActive.consumerSide()) {
  12. CONSUMER_AUTO_ACTIVES.put(alias, extensionClass);
  13. }
  14. if (LOGGER.isDebugEnabled()) {
  15. LOGGER.debug("Extension of interface " + Filter.class
  16. + ", " + implClass + "(" + alias + ") will auto active");
  17. }
  18. }
  19. }
  20. });

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

  1. /**
  2. * @param path path必须以/结尾
  3. */
  4. protected synchronized void loadFromFile(String path) {
  5. if (LOGGER.isDebugEnabled()) {
  6. LOGGER.debug("Loading extension of extensible {} from path: {}", interfaceName, path);
  7. }
  8. // 默认如果不指定文件名字,就是接口名
  9. String file = StringUtils.isBlank(extensible.file()) ? interfaceName : extensible.file().trim();
  10. String fullFileName = path + file;
  11. try {
  12. ClassLoader classLoader = ClassLoaderUtils.getClassLoader(getClass());
  13. loadFromClassLoader(classLoader, fullFileName);
  14. } catch (Throwable t) {
  15. if (LOGGER.isErrorEnabled()) {
  16. LOGGER.error("Failed to load extension of extensible " + interfaceName + " from path:" + fullFileName,
  17. t);
  18. }
  19. }
  20. }

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

  1. /**
  2. * @param path path必须以/结尾
  3. */
  4. protected synchronized void loadFromFile(String path) {
  5. if (LOGGER.isDebugEnabled()) {
  6. LOGGER.debug("Loading extension of extensible {} from path: {}", interfaceName, path);
  7. }
  8. // 默认如果不指定文件名字,就是接口名
  9. String file = StringUtils.isBlank(extensible.file()) ? interfaceName : extensible.file().trim();
  10. String fullFileName = path + file;
  11. try {
  12. ClassLoader classLoader = ClassLoaderUtils.getClassLoader(getClass());
  13. loadFromClassLoader(classLoader, fullFileName);
  14. } catch (Throwable t) {
  15. if (LOGGER.isErrorEnabled()) {
  16. LOGGER.error("Failed to load extension of extensible " + interfaceName + " from path:" + fullFileName,
  17. t);
  18. }
  19. }
  20. }

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

  1. @Override
  2. public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
  3. if (LOGGER.isDebugEnabled(config.getAppName())) {
  4. LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]");
  5. }
  6. switch (event.getType()) {
  7. case CHILD_ADDED: //新增IP级配置
  8. overrideObserver.addConfig(config, overridePath, event.getData());
  9. break;
  10. case CHILD_REMOVED: //删除IP级配置
  11. overrideObserver.removeConfig(config, overridePath, event.getData(), registerConfig);
  12. break;
  13. case CHILD_UPDATED:// 更新IP级配置
  14. overrideObserver.updateConfig(config, overridePath, event.getData());
  15. break;
  16. default:
  17. break;
  18. }
  19. }
  20. });

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

  1. @Override
  2. public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
  3. if (LOGGER.isDebugEnabled(config.getAppName())) {
  4. LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]");
  5. }
  6. switch (event.getType()) {
  7. case CHILD_ADDED: //新增IP级配置
  8. overrideObserver.addConfig(config, overridePath, event.getData());
  9. break;
  10. case CHILD_REMOVED: //删除IP级配置
  11. overrideObserver.removeConfig(config, overridePath, event.getData(), registerConfig);
  12. break;
  13. case CHILD_UPDATED:// 更新IP级配置
  14. overrideObserver.updateConfig(config, overridePath, event.getData());
  15. break;
  16. default:
  17. break;
  18. }
  19. }
  20. });

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

  1. @Override
  2. public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
  3. if (LOGGER.isDebugEnabled(config.getAppName())) {
  4. LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]");
  5. }
  6. switch (event.getType()) {
  7. case CHILD_ADDED: //新增接口级配置
  8. configObserver.addConfig(config, configPath, event.getData());
  9. break;
  10. case CHILD_REMOVED: //删除接口级配置
  11. configObserver.removeConfig(config, configPath, event.getData());
  12. break;
  13. case CHILD_UPDATED:// 更新接口级配置
  14. configObserver.updateConfig(config, configPath, event.getData());
  15. break;
  16. default:
  17. break;
  18. }
  19. }
  20. });

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

  1. @Override
  2. public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
  3. if (LOGGER.isDebugEnabled(config.getAppName())) {
  4. LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]");
  5. }
  6. switch (event.getType()) {
  7. case CHILD_ADDED: //新增接口级配置
  8. configObserver.addConfig(config, configPath, event.getData());
  9. break;
  10. case CHILD_REMOVED: //删除接口级配置
  11. configObserver.removeConfig(config, configPath, event.getData());
  12. break;
  13. case CHILD_UPDATED:// 更新接口级配置
  14. configObserver.updateConfig(config, configPath, event.getData());
  15. break;
  16. default:
  17. break;
  18. }
  19. }
  20. });

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

  1. protected void initClientTransport(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
  2. try {
  3. transport.connect();
  4. if (doubleCheck(interfaceId, providerInfo, transport)) {
  5. printSuccess(interfaceId, providerInfo, transport);
  6. addAlive(providerInfo, transport);
  7. } else {
  8. printFailure(interfaceId, providerInfo, transport);
  9. addRetry(providerInfo, transport);
  10. }
  11. } catch (Exception e) {
  12. if (LOGGER.isDebugEnabled(consumerConfig.getAppName())) {
  13. LOGGER.debugWithApp(consumerConfig.getAppName(), "Failed to connect " + providerInfo, e);
  14. }
  15. printDead(interfaceId, providerInfo, transport, e);
  16. addRetry(providerInfo, transport);
  17. }
  18. }

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

  1. protected void initClientTransport(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
  2. try {
  3. transport.connect();
  4. if (doubleCheck(interfaceId, providerInfo, transport)) {
  5. printSuccess(interfaceId, providerInfo, transport);
  6. addAlive(providerInfo, transport);
  7. } else {
  8. printFailure(interfaceId, providerInfo, transport);
  9. addRetry(providerInfo, transport);
  10. }
  11. } catch (Exception e) {
  12. if (LOGGER.isDebugEnabled(consumerConfig.getAppName())) {
  13. LOGGER.debugWithApp(consumerConfig.getAppName(), "Failed to connect " + providerInfo, e);
  14. }
  15. printDead(interfaceId, providerInfo, transport, e);
  16. addRetry(providerInfo, transport);
  17. }
  18. }

相关文章