org.apache.dubbo.common.logger.Logger类的使用及代码示例

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

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

Logger介绍

[英]Logger interface

This interface is referred from commons-logging
[中]记录器接口
此接口引用自commons日志记录

代码示例

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

public static void warn(Logger logger, String msg, Throwable e) {
  if (logger == null) {
    return;
  }
  if (logger.isWarnEnabled()) {
    logger.warn(msg, e);
  }
}

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

@Override
  public void run() {
    try {
      clean(); // Remove the expired
    } catch (Throwable t) { // Defensive fault tolerance
      logger.error("Unexpected exception occur at clean expired provider, cause: " + t.getMessage(), t);
    }
  }
}, cleanPeriod, cleanPeriod, TimeUnit.MILLISECONDS);

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

public static void info(Logger logger, String msg, Throwable e) {
  if (logger == null) {
    return;
  }
  if (logger.isInfoEnabled()) {
    logger.info(msg, e);
  }
}

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

public static void debug(Logger logger, Throwable e) {
  if (logger == null) {
    return;
  }
  if (logger.isDebugEnabled()) {
    logger.debug(e);
  }
}

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

void loadProperties() {
  if (file != null && file.exists()) {
    try (InputStream in = new FileInputStream(file)) {
      properties.load(in);
      if (logger.isInfoEnabled()) {
        logger.info("Load service store file " + file + ", data: " + properties);
      }
    } catch (Throwable e) {
      logger.warn("Failed to load service store file " + file, e);
    }
  }
}

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

public void close() {
  try {
    if (executor != null) {
      executor.shutdown();
    }
  } catch (Throwable t) {
    logger.warn("fail to destroy thread pool of server: " + t.getMessage(), t);
  }
}

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

private void decode(Object message) {
  if (message != null && message instanceof Decodeable) {
    try {
      ((Decodeable) message).decode();
      if (log.isDebugEnabled()) {
        log.debug("Decode decodeable message " + message.getClass().getName());
      }
    } catch (Throwable e) {
      if (log.isWarnEnabled()) {
        log.warn("Call Decodeable.decode failed: " + e.getMessage(), e);
      }
    } // ~ end of catch
  } // ~ end of if
} // ~ end of method decode

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

@Override
public void info(Throwable e) {
  try {
    logger.info(e);
  } catch (Throwable t) {
  }
}

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

public static void error(Logger logger, String msg) {
  if (logger == null) {
    return;
  }
  if (logger.isErrorEnabled()) {
    logger.error(msg);
  }
}

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

@Override
public void debug(Throwable e) {
  try {
    logger.debug(e);
  } catch (Throwable t) {
  }
}

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

@Override
public boolean isWarnEnabled() {
  try {
    return logger.isWarnEnabled();
  } catch (Throwable t) {
    return false;
  }
}

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

@Override
public boolean isDebugEnabled() {
  try {
    return logger.isDebugEnabled();
  } catch (Throwable t) {
    return false;
  }
}

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

void loadProperties() {
  if (file != null && file.exists()) {
    try (InputStream in = new FileInputStream(file)) {
      properties.load(in);
      if (logger.isInfoEnabled()) {
        logger.info("Load service store file " + file + ", data: " + properties);
      }
    } catch (Throwable e) {
      logger.warn("Failed to load service store file " + file, e);
    }
  }
}

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

/**
 * If {@link #REQUEST_WITH_WARNING_KEY} is configured, then warn once every 5000 invocations.
 */
private void warning() {
  if (requestWithWarning) {
    if (warningcount.get() % warning_period == 0) {
      logger.warn(new IllegalStateException("safe guard client , should not be called ,must have a bug."));
    }
    warningcount.incrementAndGet();
  }
}

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

private void decode(Object message) {
  if (message != null && message instanceof Decodeable) {
    try {
      ((Decodeable) message).decode();
      if (log.isDebugEnabled()) {
        log.debug("Decode decodeable message " + message.getClass().getName());
      }
    } catch (Throwable e) {
      if (log.isWarnEnabled()) {
        log.warn("Call Decodeable.decode failed: " + e.getMessage(), e);
      }
    } // ~ end of catch
  } // ~ end of if
} // ~ end of method decode

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

@Override
public void info(Throwable e) {
  try {
    logger.info(e);
  } catch (Throwable t) {
  }
}

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

public static void debug(Logger logger, Throwable e) {
  if (logger == null) {
    return;
  }
  if (logger.isDebugEnabled()) {
    logger.debug(e);
  }
}

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

public static void error(Logger logger, Throwable e) {
  if (logger == null) {
    return;
  }
  if (logger.isErrorEnabled()) {
    logger.error(e);
  }
}

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

@Override
public void debug(Throwable e) {
  try {
    logger.debug(e);
  } catch (Throwable t) {
  }
}

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

@Override
public boolean isWarnEnabled() {
  try {
    return logger.isWarnEnabled();
  } catch (Throwable t) {
    return false;
  }
}

相关文章