java.util.logging.Logger.updateDalvikLogHandler()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(115)

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

Logger.updateDalvikLogHandler介绍

[英]We've optimized for the common case: logging to a single handler that implements DalvikLogHandler. This is how Android framework applications are configured by default.

This optimization has been measured to show a 2.75x improvement in throughput in the common case: 154ns vs. 56ns per message on a Cortex-A8. Direct use of android.util.Log takes 29ns per message.

Each time the handler configuration changes, either directly or indirectly, it's necessary to either turn on or off this optimization. When the optimization is off, #dalvikLogHandler is assigned to #GENERAL_LOG_HANDLER which can satisfy arbitrary configuration. When the optimization is possible, #dalvikLogHandler is assigned to the user's efficient implementation. In pratice this is usually the com.android.internal.logging.AndroidHandler.
[中]我们针对常见情况进行了优化:登录到实现DalvikLogHandler的单个处理程序。这是默认情况下Android框架应用程序的配置方式。
对这种优化进行了测量,结果表明,在普通情况下,吞吐量提高了2.75倍:Cortex-A8上每条消息的吞吐量分别为154ns和56ns。直接使用android。util。日志每条消息需要29纳秒。
每次处理程序配置直接或间接更改时,都需要打开或关闭此优化。当优化关闭时,#dalvikLogHandler被分配给#GENERAL_LOG_HANDLER,它可以满足任意配置。当可以进行优化时,会将#dalvikLogHandler分配给用户的高效实现。在实践中,这通常是com。安卓内部的登录中。安德鲁德·汉德勒。

代码示例

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

void reset() {
    levelObjVal = null;
    levelIntVal = Level.INFO.intValue();

    for (Handler handler : handlers) {
      try {
        if (handlers.remove(handler)) {
          handler.close();
        }
      } catch (Exception ignored) {
      }
    }

    updateDalvikLogHandler();
  }
}

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

/**
 * Sets the flag which indicates whether to use the handlers of this
 * logger's parent, potentially recursively up the namespace.
 *
 * @param notifyParentHandlers
 *            the new flag indicating whether to use the parent's handlers.
 */
public void setUseParentHandlers(boolean notifyParentHandlers) {
  // Anonymous loggers can always set the useParentHandlers flag
  if (this.isNamed) {
    LogManager.getLogManager().checkAccess();
  }
  this.notifyParentHandlers = notifyParentHandlers;
  updateDalvikLogHandler();
}

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

/**
 * Sets the parent of this logger in the namespace. Callers must first
 * {@link #checkAccess() check security}.
 *
 * @param newParent
 *            the parent logger to set.
 */
synchronized void setParent(Logger logger, Logger newParent) {
  logger.parent = newParent;
  if (logger.levelObjVal == null) {
    setLevelRecursively(logger, null);
  }
  newParent.children.add(logger);
  logger.updateDalvikLogHandler();
}

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

/**
 * Adds a handler to this logger. The {@code name} will be fed with log
 * records received by this logger.
 *
 * @param handler
 *            the handler object to add, cannot be {@code null}.
 */
public void addHandler(Handler handler) {
  if (handler == null) {
    throw new NullPointerException("handler == null");
  }
  // Anonymous loggers can always add handlers
  if (this.isNamed) {
    LogManager.getLogManager().checkAccess();
  }
  this.handlers.add(handler);
  updateDalvikLogHandler();
}

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

/**
 * Removes a handler from this logger. If the specified handler does not
 * exist then this method has no effect.
 *
 * @param handler
 *            the handler to be removed.
 */
public void removeHandler(Handler handler) {
  // Anonymous loggers can always remove handlers
  if (this.isNamed) {
    LogManager.getLogManager().checkAccess();
  }
  if (handler == null) {
    return;
  }
  this.handlers.remove(handler);
  updateDalvikLogHandler();
}

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

logger.updateDalvikLogHandler();

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

/**
 * Constructs a {@code Logger} object with the supplied name and resource
 * bundle name; {@code notifiyParentHandlers} is set to {@code true}.
 * <p>
 * Notice : Loggers use a naming hierarchy. Thus "z.x.y" is a child of "z.x".
 *
 * @param name
 *            the name of this logger, may be {@code null} for anonymous
 *            loggers.
 * @param resourceBundleName
 *            the name of the resource bundle used to localize logging
 *            messages, may be {@code null}.
 * @throws MissingResourceException
 *             if the specified resource bundle can not be loaded.
 */
protected Logger(String name, String resourceBundleName) {
  this.name = name;
  initResourceBundle(resourceBundleName);
  this.androidTag = DalvikLogging.loggerNameToTag(name);
  updateDalvikLogHandler();
}

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

updateDalvikLogHandler();

代码示例来源:origin: ibinti/bugvm

void reset() {
    levelObjVal = null;
    levelIntVal = Level.INFO.intValue();

    for (Handler handler : handlers) {
      try {
        if (handlers.remove(handler)) {
          handler.close();
        }
      } catch (Exception ignored) {
      }
    }

    updateDalvikLogHandler();
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

void reset() {
    levelObjVal = null;
    levelIntVal = Level.INFO.intValue();

    for (Handler handler : handlers) {
      try {
        if (handlers.remove(handler)) {
          handler.close();
        }
      } catch (Exception ignored) {
      }
    }

    updateDalvikLogHandler();
  }
}

代码示例来源:origin: MobiVM/robovm

void reset() {
    levelObjVal = null;
    levelIntVal = Level.INFO.intValue();

    for (Handler handler : handlers) {
      try {
        if (handlers.remove(handler)) {
          handler.close();
        }
      } catch (Exception ignored) {
      }
    }

    updateDalvikLogHandler();
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Sets the parent of this logger in the namespace. Callers must first
 * {@link #checkAccess() check security}.
 *
 * @param newParent
 *            the parent logger to set.
 */
synchronized void setParent(Logger logger, Logger newParent) {
  logger.parent = newParent;
  if (logger.levelObjVal == null) {
    setLevelRecursively(logger, null);
  }
  newParent.children.add(logger);
  logger.updateDalvikLogHandler();
}

代码示例来源:origin: ibinti/bugvm

/**
 * Sets the flag which indicates whether to use the handlers of this
 * logger's parent, potentially recursively up the namespace.
 *
 * @param notifyParentHandlers
 *            the new flag indicating whether to use the parent's handlers.
 */
public void setUseParentHandlers(boolean notifyParentHandlers) {
  // Anonymous loggers can always set the useParentHandlers flag
  if (this.isNamed) {
    LogManager.getLogManager().checkAccess();
  }
  this.notifyParentHandlers = notifyParentHandlers;
  updateDalvikLogHandler();
}

代码示例来源:origin: MobiVM/robovm

/**
 * Sets the parent of this logger in the namespace. Callers must first
 * {@link #checkAccess() check security}.
 *
 * @param newParent
 *            the parent logger to set.
 */
synchronized void setParent(Logger logger, Logger newParent) {
  logger.parent = newParent;
  if (logger.levelObjVal == null) {
    setLevelRecursively(logger, null);
  }
  newParent.children.add(logger);
  logger.updateDalvikLogHandler();
}

代码示例来源:origin: com.gluonhq/robovm-rt

void reset() {
    levelObjVal = null;
    levelIntVal = Level.INFO.intValue();

    for (Handler handler : handlers) {
      try {
        if (handlers.remove(handler)) {
          handler.close();
        }
      } catch (Exception ignored) {
      }
    }

    updateDalvikLogHandler();
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Sets the flag which indicates whether to use the handlers of this
 * logger's parent, potentially recursively up the namespace.
 *
 * @param notifyParentHandlers
 *            the new flag indicating whether to use the parent's handlers.
 */
public void setUseParentHandlers(boolean notifyParentHandlers) {
  // Anonymous loggers can always set the useParentHandlers flag
  if (this.isNamed) {
    LogManager.getLogManager().checkAccess();
  }
  this.notifyParentHandlers = notifyParentHandlers;
  updateDalvikLogHandler();
}

代码示例来源:origin: com.bugvm/bugvm-rt

void reset() {
    levelObjVal = null;
    levelIntVal = Level.INFO.intValue();

    for (Handler handler : handlers) {
      try {
        if (handlers.remove(handler)) {
          handler.close();
        }
      } catch (Exception ignored) {
      }
    }

    updateDalvikLogHandler();
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Sets the flag which indicates whether to use the handlers of this
 * logger's parent, potentially recursively up the namespace.
 *
 * @param notifyParentHandlers
 *            the new flag indicating whether to use the parent's handlers.
 */
public void setUseParentHandlers(boolean notifyParentHandlers) {
  // Anonymous loggers can always set the useParentHandlers flag
  if (this.isNamed) {
    LogManager.getLogManager().checkAccess();
  }
  this.notifyParentHandlers = notifyParentHandlers;
  updateDalvikLogHandler();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Sets the parent of this logger in the namespace. Callers must first
 * {@link #checkAccess() check security}.
 *
 * @param newParent
 *            the parent logger to set.
 */
synchronized void setParent(Logger logger, Logger newParent) {
  logger.parent = newParent;
  if (logger.levelObjVal == null) {
    setLevelRecursively(logger, null);
  }
  newParent.children.add(logger);
  logger.updateDalvikLogHandler();
}

代码示例来源:origin: FlexoVM/flexovm

void reset() {
    levelObjVal = null;
    levelIntVal = Level.INFO.intValue();

    for (Handler handler : handlers) {
      try {
        if (handlers.remove(handler)) {
          handler.close();
        }
      } catch (Exception ignored) {
      }
    }

    updateDalvikLogHandler();
  }
}

相关文章