org.apache.openejb.util.Logger.log4j()方法的使用及代码示例

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

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

Logger.log4j介绍

暂无

代码示例

代码示例来源:origin: org.apache.openejb/openejb-core

public static boolean isLog4jImplied() {
  if (null == isLog4j) {
    isLog4j = false;
    final List<String> locations = new ArrayList<String>();
    {
      final Properties configFile = log4j(loadLoggingProperties());
      final Properties systemProperties = log4j(SystemInstance.get().getProperties());
      if (configFile.size() > 0) {
        locations.add("conf/logging.properties");
      }
      if (systemProperties.size() > 0) {
        locations.add("Properties overrides");
      }
    }
    if (locations.size() > 0) {
      if (exists("org.apache.log4j.Logger")) {
        isLog4j = true;
      }
    }
  }
  return isLog4j;
}

代码示例来源:origin: org.apache.tomee/openejb-core

public static boolean isLog4jImplied() {
  if (null == isLog4j) {
    isLog4j = false;
    final List<String> locations = new ArrayList<String>();
    {
      final Properties configFile = log4j(loadLoggingProperties());
      final Properties systemProperties = log4j(SystemInstance.get().getProperties());
      if (configFile.size() > 0) {
        locations.add("conf/logging.properties");
      }
      if (systemProperties.size() > 0) {
        locations.add("Properties overrides");
      }
    }
    if (locations.size() > 0) {
      if (exists("org.apache.log4j.Logger")) {
        isLog4j = true;
      }
    }
  }
  return isLog4j;
}

代码示例来源:origin: org.apache.openejb/openejb-core

private static void checkForIgnoredLog4jConfig() {
  if (logStreamFactory.getClass().getName().equals("org.apache.openejb.util.Log4jLogStreamFactory")) {
    return;
  }
  try {
    final Properties configFile = log4j(loadLoggingProperties());
    final Properties systemProperties = log4j(SystemInstance.get().getProperties());
    if (configFile.size() == 0 && systemProperties.size() == 0) {
      return;
    }
    final LogStream stream = logStreamFactory.createLogStream(LogCategory.OPENEJB);
    stream.warn("Log4j not installed. The following properties will be ignored.");
    final String format = "Ignored %s property '%s'";
    for (final Object key : configFile.keySet()) {
      stream.warn(String.format(format, "conf/logging.properties", key));
    }
    for (final Object key : systemProperties.keySet()) {
      stream.warn(String.format(format, "Property overrides", key));
    }
  } catch (final Throwable e) {
    // added strong catch block just in case
    // This check is only a convenience
  }
}

代码示例来源:origin: org.apache.tomee/openejb-core

private static void checkForIgnoredLog4jConfig() {
  if (logStreamFactory.getClass().getName().equals("org.apache.openejb.util.Log4jLogStreamFactory")) {
    return;
  }
  try {
    final Properties configFile = log4j(loadLoggingProperties());
    final Properties systemProperties = log4j(SystemInstance.get().getProperties());
    if (configFile.size() == 0 && systemProperties.size() == 0) {
      return;
    }
    if (systemProperties.size() == 1 && "log4j.configurationFile".equals(systemProperties.stringPropertyNames().iterator().next())) {
      // not a logger config but the overall config
      // since log4j2 uses it too we can't pollute logs with warnings there for that only
      return;
    }
    final LogStream stream = logStreamFactory.createLogStream(LogCategory.OPENEJB);
    stream.warn("Log4j not installed. The following properties will be ignored.");
    final String format = "Ignored %s property '%s'";
    for (final Object key : configFile.keySet()) {
      stream.warn(String.format(format, "conf/logging.properties", key));
    }
    for (final Object key : systemProperties.keySet()) {
      stream.warn(String.format(format, "Property overrides", key));
    }
  } catch (final Throwable e) {
    // added strong catch block just in case
    // This check is only a convenience
  }
}

相关文章