org.slf4j.helpers.Util.getCallingClass()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(94)

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

Util.getCallingClass介绍

[英]Returns the name of the class which called the invoking method.
[中]返回调用调用方法的类的名称。

代码示例

代码示例来源:origin: redisson/redisson

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: wildfly/wildfly

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: com.centurylink.mdw/mdw-common

public static StandardLogger getStandardLogger() {
  String loggerImplClass = System.getProperty(MDW_LOGGER_IMPL);
  if (!accessed && loggerImplClass != null) {
    System.out.println("\nUsing Logger Impl: " + loggerImplClass);
    accessed = true;
  }
  // avoid reflection for known impls
  if (loggerImplClass == null) {
    return new Slf4JStandardLoggerImpl(Util.getCallingClass().getName());
  }
  else if (SimpleLogger.class.getName().equals(loggerImplClass)) {
    return SimpleLogger.getSingleton();
  }
  else if (Log4JStandardLoggerImpl.class.getName().equals(loggerImplClass) || org.apache.log4j.Logger.class.getName().equals(loggerImplClass)) {
    return new Log4JStandardLoggerImpl();
  }
  else if (Slf4JStandardLoggerImpl.class.getName().equals(loggerImplClass) || org.slf4j.Logger.class.getName().equals(loggerImplClass)) {
    return new Slf4JStandardLoggerImpl(Util.getCallingClass().getName());
  }
  else {
    try {
      return Class.forName(loggerImplClass).asSubclass(StandardLogger.class).newInstance();
    }
    catch (Exception ex) {
      ex.printStackTrace();  // logging isn't working
      return null;
    }
  }
}

代码示例来源:origin: com.github.oshi/oshi-core-shaded

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: uk.co.nichesolutions/slf4j-api

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: org.gandon.tomcat/juli-to-slf4j

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".",

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: org.apache.activemq/activemq-all

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: org.jboss.eap/wildfly-client-all

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: io.virtdata/virtdata-lib-realer

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: ops4j/org.ops4j.pax.logging

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

代码示例来源:origin: Nextdoor/bender

Logger logger = getLogger(clazz.getName());
if (DETECT_LOGGER_NAME_MISMATCH) {
  Class<?> autoComputedCallingClass = Util.getCallingClass();
  if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
    Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),

相关文章