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

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

本文整理了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

  1. /**
  2. Returns all the currently defined categories in the default
  3. hierarchy as an {@link java.util.Enumeration Enumeration}.
  4. <p>The root category is <em>not</em> included in the returned
  5. {@link Enumeration}.
  6. @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
  7. */
  8. public
  9. static
  10. Enumeration getCurrentCategories() {
  11. return LogManager.getCurrentLoggers();
  12. }

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

  1. /**
  2. * Prints the configuration of the default log4j hierarchy as a Java
  3. * properties file on the specified Writer.
  4. *
  5. * <p>N.B. print() can be invoked only once!
  6. */
  7. public
  8. void print(PrintWriter out) {
  9. printOptions(out, Logger.getRootLogger());
  10. Enumeration cats = LogManager.getCurrentLoggers();
  11. while (cats.hasMoreElements()) {
  12. printOptions(out, (Logger) cats.nextElement());
  13. }
  14. }

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

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

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

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

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

  1. /**
  2. Returns all the currently defined categories in the default
  3. hierarchy as an {@link java.util.Enumeration Enumeration}.
  4. <p>The root category is <em>not</em> included in the returned
  5. {@link Enumeration}.
  6. @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
  7. */
  8. public
  9. static
  10. Enumeration getCurrentCategories() {
  11. return LogManager.getCurrentLoggers();
  12. }

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

  1. /**
  2. Returns all the currently defined categories in the default
  3. hierarchy as an {@link java.util.Enumeration Enumeration}.
  4. <p>The root category is <em>not</em> included in the returned
  5. {@link Enumeration}.
  6. @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
  7. */
  8. public
  9. static
  10. Enumeration getCurrentCategories() {
  11. return LogManager.getCurrentLoggers();
  12. }

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

  1. /**
  2. * Prints the configuration of the default log4j hierarchy as a Java
  3. * properties file on the specified Writer.
  4. *
  5. * <p>N.B. print() can be invoked only once!
  6. */
  7. public
  8. void print(PrintWriter out) {
  9. printOptions(out, Logger.getRootLogger());
  10. Enumeration cats = LogManager.getCurrentLoggers();
  11. while (cats.hasMoreElements()) {
  12. printOptions(out, (Logger) cats.nextElement());
  13. }
  14. }

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

  1. /**
  2. * Prints the configuration of the default log4j hierarchy as a Java
  3. * properties file on the specified Writer.
  4. *
  5. * <p>N.B. print() can be invoked only once!
  6. */
  7. public
  8. void print(PrintWriter out) {
  9. printOptions(out, Logger.getRootLogger());
  10. Enumeration cats = LogManager.getCurrentLoggers();
  11. while (cats.hasMoreElements()) {
  12. printOptions(out, (Logger) cats.nextElement());
  13. }
  14. }

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

  1. private static boolean isConfigured() {
  2. //Borrowed from: http://wiki.apache.org/logging-log4j/UsefulCode
  3. Enumeration appenders = LogManager.getRootLogger().getAllAppenders();
  4. if (appenders.hasMoreElements()) {
  5. return true;
  6. }
  7. else {
  8. Enumeration loggers = LogManager.getCurrentLoggers() ;
  9. while (loggers.hasMoreElements()) {
  10. org.apache.log4j.Logger c = (org.apache.log4j.Logger) loggers.nextElement();
  11. if (c.getAllAppenders().hasMoreElements())
  12. return true;
  13. }
  14. }
  15. return false;
  16. }

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

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

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

  1. /**
  2. Returns all the currently defined categories in the default
  3. hierarchy as an {@link java.util.Enumeration Enumeration}.
  4. <p>The root category is <em>not</em> included in the returned
  5. {@link Enumeration}.
  6. @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
  7. */
  8. public
  9. static
  10. Enumeration getCurrentCategories() {
  11. return LogManager.getCurrentLoggers();
  12. }

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

  1. /**
  2. Returns all the currently defined categories in the default
  3. hierarchy as an {@link java.util.Enumeration Enumeration}.
  4. <p>The root category is <em>not</em> included in the returned
  5. {@link Enumeration}.
  6. @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
  7. */
  8. public
  9. static
  10. Enumeration getCurrentCategories() {
  11. return LogManager.getCurrentLoggers();
  12. }

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

  1. /**
  2. Returns all the currently defined categories in the default
  3. hierarchy as an {@link java.util.Enumeration Enumeration}.
  4. <p>The root category is <em>not</em> included in the returned
  5. {@link Enumeration}.
  6. @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
  7. */
  8. public
  9. static
  10. Enumeration getCurrentCategories() {
  11. return LogManager.getCurrentLoggers();
  12. }

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

  1. /**
  2. Returns all the currently defined categories in the default
  3. hierarchy as an {@link java.util.Enumeration Enumeration}.
  4. <p>The root category is <em>not</em> included in the returned
  5. {@link Enumeration}.
  6. @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
  7. */
  8. public
  9. static
  10. Enumeration getCurrentCategories() {
  11. return LogManager.getCurrentLoggers();
  12. }

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

  1. /**
  2. Returns all the currently defined categories in the default
  3. hierarchy as an {@link java.util.Enumeration Enumeration}.
  4. <p>The root category is <em>not</em> included in the returned
  5. {@link Enumeration}.
  6. @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
  7. */
  8. public
  9. static
  10. Enumeration getCurrentCategories() {
  11. return LogManager.getCurrentLoggers();
  12. }

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

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

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

  1. @SuppressWarnings("unchecked")
  2. public static void changeLevelOfAllLoggersTo(Level level) {
  3. final Enumeration<org.apache.log4j.Logger> loggers = LogManager.getCurrentLoggers();
  4. while (loggers.hasMoreElements()) {
  5. final org.apache.log4j.Logger l = loggers.nextElement();
  6. l.setLevel(level);
  7. }
  8. }
  9. }

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

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

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

  1. @Managed(description = "Get the current loggers names")
  2. public String[] getLoggerNames()
  3. {
  4. final Enumeration<Logger> e = LogManager.getCurrentLoggers();
  5. final List<String> loggers = new ArrayList<String>();
  6. while (e.hasMoreElements()) {
  7. final Logger logger = e.nextElement();
  8. loggers.add(logger.getName());
  9. }
  10. Collections.sort(loggers);
  11. return loggers.toArray(new String[0]);
  12. }

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

  1. @Override
  2. public void changeAll(LoggerLevel loggerLevel) {
  3. Level newLevel = transToLog4j(loggerLevel);
  4. Enumeration<Logger> currentLoggers = LogManager.getCurrentLoggers();
  5. while (currentLoggers.hasMoreElements()) {
  6. changeToNewLevel(newLevel, currentLoggers.nextElement());
  7. }
  8. changeToNewLevel(newLevel, LogManager.getRootLogger());
  9. }

相关文章