org.apache.log4j.LogManager.getCurrentLoggers()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(181)

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

LogManager.getCurrentLoggers介绍

[英]This bogus implementation returns an empty enumeration.
[中]这个伪实现返回一个空枚举。

代码示例

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

/**
  Returns all the currently defined categories in the default
  hierarchy as an {@link java.util.Enumeration Enumeration}.
  <p>The root category is <em>not</em> included in the returned
  {@link Enumeration}.
  @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
*/
public
static
Enumeration getCurrentCategories() {
 return LogManager.getCurrentLoggers();
}

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

/**
 * Prints the configuration of the default log4j hierarchy as a Java
 * properties file on the specified Writer.
 * 
 * <p>N.B. print() can be invoked only once!
 */
public
void print(PrintWriter out) {
 printOptions(out, Logger.getRootLogger());
 
 Enumeration cats = LogManager.getCurrentLoggers();
 while (cats.hasMoreElements()) {
  printOptions(out, (Logger) cats.nextElement());
 }
}

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

Enumeration<org.apache.log4j.Logger> ls = LogManager.getCurrentLoggers();
while (ls.hasMoreElements()) {
  org.apache.log4j.Logger l = ls.nextElement();

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

Enumeration<org.apache.log4j.Logger> ls = LogManager.getCurrentLoggers();
while (ls.hasMoreElements()) {
  org.apache.log4j.Logger l = ls.nextElement();

代码示例来源:origin: camunda/camunda-bpm-platform

/**
  Returns all the currently defined categories in the default
  hierarchy as an {@link java.util.Enumeration Enumeration}.
  <p>The root category is <em>not</em> included in the returned
  {@link Enumeration}.
  @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
*/
public
static
Enumeration getCurrentCategories() {
 return LogManager.getCurrentLoggers();
}

代码示例来源:origin: apache/log4j

/**
  Returns all the currently defined categories in the default
  hierarchy as an {@link java.util.Enumeration Enumeration}.
  <p>The root category is <em>not</em> included in the returned
  {@link Enumeration}.
  @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
*/
public
static
Enumeration getCurrentCategories() {
 return LogManager.getCurrentLoggers();
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Prints the configuration of the default log4j hierarchy as a Java
 * properties file on the specified Writer.
 * 
 * <p>N.B. print() can be invoked only once!
 */
public
void print(PrintWriter out) {
 printOptions(out, Logger.getRootLogger());
 
 Enumeration cats = LogManager.getCurrentLoggers();
 while (cats.hasMoreElements()) {
  printOptions(out, (Logger) cats.nextElement());
 }
}

代码示例来源:origin: apache/log4j

/**
 * Prints the configuration of the default log4j hierarchy as a Java
 * properties file on the specified Writer.
 * 
 * <p>N.B. print() can be invoked only once!
 */
public
void print(PrintWriter out) {
 printOptions(out, Logger.getRootLogger());
 
 Enumeration cats = LogManager.getCurrentLoggers();
 while (cats.hasMoreElements()) {
  printOptions(out, (Logger) cats.nextElement());
 }
}

代码示例来源:origin: apache/tika

private static boolean isConfigured() {
  //Borrowed from: http://wiki.apache.org/logging-log4j/UsefulCode
  Enumeration appenders = LogManager.getRootLogger().getAllAppenders();
  if (appenders.hasMoreElements()) {
    return true;
  }
  else {
    Enumeration loggers = LogManager.getCurrentLoggers() ;
    while (loggers.hasMoreElements()) {
      org.apache.log4j.Logger c = (org.apache.log4j.Logger) loggers.nextElement();
      if (c.getAllAppenders().hasMoreElements())
        return true;
    }
  }
  return false;
}

代码示例来源:origin: pentaho/mondrian

Enumeration e = LogManager.getCurrentLoggers();
while (e.hasMoreElements()) {
  Logger logger = (Logger) e.nextElement();

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

/**
  Returns all the currently defined categories in the default
  hierarchy as an {@link java.util.Enumeration Enumeration}.
  <p>The root category is <em>not</em> included in the returned
  {@link Enumeration}.
  @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
*/
public
static
Enumeration getCurrentCategories() {
 return LogManager.getCurrentLoggers();
}

代码示例来源:origin: org.apache/log4j

/**
  Returns all the currently defined categories in the default
  hierarchy as an {@link java.util.Enumeration Enumeration}.
  <p>The root category is <em>not</em> included in the returned
  {@link Enumeration}.
  @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
*/
public
static
Enumeration getCurrentCategories() {
 return LogManager.getCurrentLoggers();
}

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

/**
  Returns all the currently defined categories in the default
  hierarchy as an {@link java.util.Enumeration Enumeration}.
  <p>The root category is <em>not</em> included in the returned
  {@link Enumeration}.
  @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
*/
public
static
Enumeration getCurrentCategories() {
 return LogManager.getCurrentLoggers();
}

代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j

/**
  Returns all the currently defined categories in the default
  hierarchy as an {@link java.util.Enumeration Enumeration}.
  <p>The root category is <em>not</em> included in the returned
  {@link Enumeration}.
  @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
*/
public
static
Enumeration getCurrentCategories() {
 return LogManager.getCurrentLoggers();
}

代码示例来源:origin: apache-log4j/log4j

/**
  Returns all the currently defined categories in the default
  hierarchy as an {@link java.util.Enumeration Enumeration}.
  <p>The root category is <em>not</em> included in the returned
  {@link Enumeration}.
  @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
*/
public
static
Enumeration getCurrentCategories() {
 return LogManager.getCurrentLoggers();
}

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

/**
 * Returns all the currently defined categories in the default hierarchy as an {@link java.util.Enumeration Enumeration}.
 * 
 * <p>
 * The root category is <em>not</em> included in the returned {@link Enumeration}.
 * 
 * @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
 */
public static Enumeration getCurrentCategories() {
  return LogManager.getCurrentLoggers();
}

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

@SuppressWarnings("unchecked")
  public static void changeLevelOfAllLoggersTo(Level level) {
    final Enumeration<org.apache.log4j.Logger> loggers = LogManager.getCurrentLoggers();
    while (loggers.hasMoreElements()) {
      final org.apache.log4j.Logger l = loggers.nextElement();
      l.setLevel(level);
    }
  }
}

代码示例来源:origin: org.apache.uima/uima-ducc-common

public void setLogLevel(String clz, String level) {
  @SuppressWarnings("unchecked")
  Enumeration<Logger> loggers = LogManager.getCurrentLoggers();
  while (loggers.hasMoreElements()) {
    Logger logger = (Logger) loggers.nextElement();
    if ( logger.getName().equals(clz)) {
      logger.setLevel(Level.toLevel(level));
      //System.out.println("---------Set New Log Level:"+level+" For Logger:"+clz);
    }
  }
}

代码示例来源:origin: com.ning.jetty/ning-service-skeleton-log4j

@Managed(description = "Get the current loggers names")
public String[] getLoggerNames()
{
  final Enumeration<Logger> e = LogManager.getCurrentLoggers();
  final List<String> loggers = new ArrayList<String>();
  while (e.hasMoreElements()) {
    final Logger logger = e.nextElement();
    loggers.add(logger.getName());
  }
  Collections.sort(loggers);
  return loggers.toArray(new String[0]);
}

代码示例来源:origin: com.github.bingoohuang/diamond-client

@Override
public void changeAll(LoggerLevel loggerLevel) {
  Level newLevel = transToLog4j(loggerLevel);
  Enumeration<Logger> currentLoggers = LogManager.getCurrentLoggers();
  while (currentLoggers.hasMoreElements()) {
    changeToNewLevel(newLevel, currentLoggers.nextElement());
  }
  changeToNewLevel(newLevel, LogManager.getRootLogger());
}

相关文章