org.apache.dubbo.common.logger.Logger.isDebugEnabled()方法的使用及代码示例

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

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

Logger.isDebugEnabled介绍

[英]Is debug logging currently enabled?
[中]调试日志记录当前是否启用?

代码示例

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. public boolean isDebugEnabled() {
  3. try {
  4. return logger.isDebugEnabled();
  5. } catch (Throwable t) {
  6. return false;
  7. }
  8. }

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. public boolean isDebugEnabled() {
  3. try {
  4. return logger.isDebugEnabled();
  5. } catch (Throwable t) {
  6. return false;
  7. }
  8. }

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. public boolean isDebugEnabled() {
  3. return logger.isDebugEnabled();
  4. }

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. public boolean isDebugEnabled() {
  3. return logger.isDebugEnabled();
  4. }

代码示例来源:origin: apache/incubator-dubbo

  1. public static void debug(Logger logger, String msg, Throwable e) {
  2. if (logger == null) {
  3. return;
  4. }
  5. if (logger.isDebugEnabled()) {
  6. logger.debug(msg, e);
  7. }
  8. }

代码示例来源:origin: apache/incubator-dubbo

  1. public static void debug(Logger logger, Throwable e) {
  2. if (logger == null) {
  3. return;
  4. }
  5. if (logger.isDebugEnabled()) {
  6. logger.debug(e);
  7. }
  8. }

代码示例来源:origin: apache/incubator-dubbo

  1. public static void debug(Logger logger, Throwable e) {
  2. if (logger == null) {
  3. return;
  4. }
  5. if (logger.isDebugEnabled()) {
  6. logger.debug(e);
  7. }
  8. }

代码示例来源:origin: apache/incubator-dubbo

  1. public static void debug(Logger logger, String msg, Throwable e) {
  2. if (logger == null) {
  3. return;
  4. }
  5. if (logger.isDebugEnabled()) {
  6. logger.debug(msg, e);
  7. }
  8. }

代码示例来源:origin: apache/incubator-dubbo

  1. public static void debug(Logger logger, String msg) {
  2. if (logger == null) {
  3. return;
  4. }
  5. if (logger.isDebugEnabled()) {
  6. logger.debug(msg);
  7. }
  8. }

代码示例来源:origin: apache/incubator-dubbo

  1. public static void debug(Logger logger, String msg) {
  2. if (logger == null) {
  3. return;
  4. }
  5. if (logger.isDebugEnabled()) {
  6. logger.debug(msg);
  7. }
  8. }

代码示例来源:origin: apache/incubator-dubbo

  1. private void decode(Object message) {
  2. if (message != null && message instanceof Decodeable) {
  3. try {
  4. ((Decodeable) message).decode();
  5. if (log.isDebugEnabled()) {
  6. log.debug("Decode decodeable message " + message.getClass().getName());
  7. }
  8. } catch (Throwable e) {
  9. if (log.isWarnEnabled()) {
  10. log.warn("Call Decodeable.decode failed: " + e.getMessage(), e);
  11. }
  12. } // ~ end of catch
  13. } // ~ end of if
  14. } // ~ end of method decode

代码示例来源:origin: apache/incubator-dubbo

  1. private void decode(Object message) {
  2. if (message != null && message instanceof Decodeable) {
  3. try {
  4. ((Decodeable) message).decode();
  5. if (log.isDebugEnabled()) {
  6. log.debug("Decode decodeable message " + message.getClass().getName());
  7. }
  8. } catch (Throwable e) {
  9. if (log.isWarnEnabled()) {
  10. log.warn("Call Decodeable.decode failed: " + e.getMessage(), e);
  11. }
  12. } // ~ end of catch
  13. } // ~ end of if
  14. } // ~ end of method decode

代码示例来源:origin: apache/incubator-dubbo

  1. logger.warn("Find more than 1 spring extensions (beans) of type " + type.getName() + ", will stop auto injection. Please make sure you have specified the concrete parameter type and there's only one extension of that type.");
  2. } catch (NoSuchBeanDefinitionException noBeanExe) {
  3. if (logger.isDebugEnabled()) {
  4. logger.debug("Error when get spring extension(bean) for type:" + type.getName(), noBeanExe);

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
  3. if (evt instanceof IdleStateEvent) {
  4. try {
  5. NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(), url, handler);
  6. if (logger.isDebugEnabled()) {
  7. logger.debug("IdleStateEvent triggered, send heartbeat to channel " + channel);
  8. }
  9. Request req = new Request();
  10. req.setVersion(Version.getProtocolVersion());
  11. req.setTwoWay(true);
  12. req.setEvent(Request.HEARTBEAT_EVENT);
  13. channel.send(req);
  14. } finally {
  15. NettyChannel.removeChannelIfDisconnected(ctx.channel());
  16. }
  17. } else {
  18. super.userEventTriggered(ctx, evt);
  19. }
  20. }

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. public void received(Channel channel, Object message) throws RemotingException {
  3. setReadTimestamp(channel);
  4. if (isHeartbeatRequest(message)) {
  5. Request req = (Request) message;
  6. if (req.isTwoWay()) {
  7. Response res = new Response(req.getId(), req.getVersion());
  8. res.setEvent(Response.HEARTBEAT_EVENT);
  9. channel.send(res);
  10. if (logger.isInfoEnabled()) {
  11. int heartbeat = channel.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0);
  12. if (logger.isDebugEnabled()) {
  13. logger.debug("Received heartbeat from remote channel " + channel.getRemoteAddress()
  14. + ", cause: The channel has no data-transmission exceeds a heartbeat period"
  15. + (heartbeat > 0 ? ": " + heartbeat + "ms" : ""));
  16. }
  17. }
  18. }
  19. return;
  20. }
  21. if (isHeartbeatResponse(message)) {
  22. if (logger.isDebugEnabled()) {
  23. logger.debug("Receive heartbeat response in thread " + Thread.currentThread().getName());
  24. }
  25. return;
  26. }
  27. handler.received(channel, message);
  28. }

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. public void received(Channel channel, Object message) throws RemotingException {
  3. setReadTimestamp(channel);
  4. if (isHeartbeatRequest(message)) {
  5. Request req = (Request) message;
  6. if (req.isTwoWay()) {
  7. Response res = new Response(req.getId(), req.getVersion());
  8. res.setEvent(Response.HEARTBEAT_EVENT);
  9. channel.send(res);
  10. if (logger.isInfoEnabled()) {
  11. int heartbeat = channel.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0);
  12. if (logger.isDebugEnabled()) {
  13. logger.debug("Received heartbeat from remote channel " + channel.getRemoteAddress()
  14. + ", cause: The channel has no data-transmission exceeds a heartbeat period"
  15. + (heartbeat > 0 ? ": " + heartbeat + "ms" : ""));
  16. }
  17. }
  18. }
  19. return;
  20. }
  21. if (isHeartbeatResponse(message)) {
  22. if (logger.isDebugEnabled()) {
  23. logger.debug("Receive heartbeat response in thread " + Thread.currentThread().getName());
  24. }
  25. return;
  26. }
  27. handler.received(channel, message);
  28. }

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. public synchronized void process(ConfigChangeEvent event) {
  3. if (logger.isDebugEnabled()) {
  4. logger.debug("Notification of tag rule, change type is: " + event.getChangeType() + ", raw rule is:\n " +
  5. event.getValue());
  6. }
  7. try {
  8. if (event.getChangeType().equals(ConfigChangeType.DELETED)) {
  9. this.tagRouterRule = null;
  10. } else {
  11. this.tagRouterRule = TagRuleParser.parse(event.getValue());
  12. }
  13. } catch (Exception e) {
  14. logger.error("Failed to parse the raw tag router rule and it will not take effect, please check if the " +
  15. "rule matches with the template, the raw rule is:\n ", e);
  16. }
  17. }

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. public synchronized void process(ConfigChangeEvent event) {
  3. if (logger.isDebugEnabled()) {
  4. logger.debug("Notification of tag rule, change type is: " + event.getChangeType() + ", raw rule is:\n " +
  5. event.getValue());
  6. }
  7. try {
  8. if (event.getChangeType().equals(ConfigChangeType.DELETED)) {
  9. this.tagRouterRule = null;
  10. } else {
  11. this.tagRouterRule = TagRuleParser.parse(event.getValue());
  12. }
  13. } catch (Exception e) {
  14. logger.error("Failed to parse the raw tag router rule and it will not take effect, please check if the " +
  15. "rule matches with the template, the raw rule is:\n ", e);
  16. }
  17. }

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. protected void doTask(Channel channel) {
  3. try {
  4. Long lastRead = lastRead(channel);
  5. Long lastWrite = lastWrite(channel);
  6. if ((lastRead != null && now() - lastRead > heartbeat)
  7. || (lastWrite != null && now() - lastWrite > heartbeat)) {
  8. Request req = new Request();
  9. req.setVersion(Version.getProtocolVersion());
  10. req.setTwoWay(true);
  11. req.setEvent(Request.HEARTBEAT_EVENT);
  12. channel.send(req);
  13. if (logger.isDebugEnabled()) {
  14. logger.debug("Send heartbeat to remote channel " + channel.getRemoteAddress()
  15. + ", cause: The channel has no data-transmission exceeds a heartbeat period: "
  16. + heartbeat + "ms");
  17. }
  18. }
  19. } catch (Throwable t) {
  20. logger.warn("Exception when heartbeat to remote channel " + channel.getRemoteAddress(), t);
  21. }
  22. }
  23. }

代码示例来源:origin: apache/incubator-dubbo

  1. @Override
  2. protected void doTask(Channel channel) {
  3. try {
  4. Long lastRead = lastRead(channel);
  5. Long lastWrite = lastWrite(channel);
  6. if ((lastRead != null && now() - lastRead > heartbeat)
  7. || (lastWrite != null && now() - lastWrite > heartbeat)) {
  8. Request req = new Request();
  9. req.setVersion(Version.getProtocolVersion());
  10. req.setTwoWay(true);
  11. req.setEvent(Request.HEARTBEAT_EVENT);
  12. channel.send(req);
  13. if (logger.isDebugEnabled()) {
  14. logger.debug("Send heartbeat to remote channel " + channel.getRemoteAddress()
  15. + ", cause: The channel has no data-transmission exceeds a heartbeat period: "
  16. + heartbeat + "ms");
  17. }
  18. }
  19. } catch (Throwable t) {
  20. logger.warn("Exception when heartbeat to remote channel " + channel.getRemoteAddress(), t);
  21. }
  22. }
  23. }

相关文章