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

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

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

LogManager.checkAccess介绍

[英]Does nothing.
[中]什么也不做。

代码示例

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

/**
 * Remove a {@code PropertyChangeListener}, do nothing if the given
 * listener is not found.
 *
 * @param l
 *            the {@code PropertyChangeListener} to be removed.
 */
public void removePropertyChangeListener(PropertyChangeListener l) {
  checkAccess();
  listeners.removePropertyChangeListener(l);
}

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

/**
 * Sets the filter to be used by this handler.
 *
 * @param newFilter
 *            the filter to set, may be {@code null}.
 */
public void setFilter(Filter newFilter) {
  LogManager.getLogManager().checkAccess();
  this.filter = newFilter;
}

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

/**
 * Gets the error manager used by this handler to report errors during
 * logging.
 *
 * @return the error manager used by this handler.
 */
public ErrorManager getErrorManager() {
  LogManager.getLogManager().checkAccess();
  return this.errorMan;
}

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

/**
 * Sets the filter used by this logger.
 *
 * @param newFilter
 *            the filter to set, may be {@code null}.
 */
public void setFilter(Filter newFilter) {
  // Anonymous loggers can always set the filter
  if (this.isNamed) {
    LogManager.getLogManager().checkAccess();
  }
  filter = newFilter;
}

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

/**
   * Set the push level. The push level is used to check the push action
   * triggering. When a new {@code LogRecord} is put into the internal
   * buffer and its level is not less than the push level, the push action
   * will be triggered. Note that set new push level won't trigger push action.
   *
   * @param newLevel
   *                 the new level to set.
   */
  public void setPushLevel(Level newLevel) {
    manager.checkAccess();
    newLevel.intValue();
    this.push = newLevel;
  }
}

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

/**
 * Add a {@code PropertyChangeListener}, which will be invoked when
 * the properties are reread.
 *
 * @param l
 *            the {@code PropertyChangeListener} to be added.
 */
public void addPropertyChangeListener(PropertyChangeListener l) {
  if (l == null) {
    throw new NullPointerException("l == null");
  }
  checkAccess();
  listeners.addPropertyChangeListener(l);
}

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

/**
 * Sets the error manager for this handler.
 *
 * @param newErrorManager
 *            the error manager to set.
 * @throws NullPointerException
 *             if {@code em} is {@code null}.
 */
public void setErrorManager(ErrorManager newErrorManager) {
  LogManager.getLogManager().checkAccess();
  if (newErrorManager == null) {
    throw new NullPointerException("newErrorManager == null");
  }
  this.errorMan = newErrorManager;
}

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

/**
   * Sets the logging level of the messages logged by this handler, levels
   * lower than this value will be dropped.
   *
   * @param newLevel
   *            the logging level to set.
   * @throws NullPointerException
   *             if {@code newLevel} is {@code null}.
   */
  public void setLevel(Level newLevel) {
    if (newLevel == null) {
      throw new NullPointerException("newLevel == null");
    }
    LogManager.getLogManager().checkAccess();
    this.level = newLevel;
  }
}

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

/**
 * Closes this handler. The tail string of the formatter associated with
 * this handler is written out. A flush operation and a subsequent close
 * operation is then performed upon the output stream. Client applications
 * should not use a handler after closing it.
 */
@Override
public void close() {
  LogManager.getLogManager().checkAccess();
  close(true);
}

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

/**
 * Sets the formatter to be used by this handler.
 *
 * @param newFormatter
 *            the formatter to set.
 * @throws NullPointerException
 *             if {@code newFormatter} is {@code null}.
 */
public void setFormatter(Formatter newFormatter) {
  LogManager.getLogManager().checkAccess();
  internalSetFormatter(newFormatter);
}

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

/**
 * Sets the character encoding used by this handler, {@code null} indicates
 * a default encoding.
 *
 * @throws UnsupportedEncodingException if {@code charsetName} is not supported.
 */
public void setEncoding(String charsetName) throws UnsupportedEncodingException {
  LogManager.getLogManager().checkAccess();
  internalSetEncoding(charsetName);
}

代码示例来源: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 logging level for this logger. A {@code null} level indicates
 * that this logger will inherit its parent's level.
 *
 * @param newLevel
 *            the logging level to set.
 */
public void setLevel(Level newLevel) {
  // Anonymous loggers can always set the level
  LogManager logManager = LogManager.getLogManager();
  if (this.isNamed) {
    logManager.checkAccess();
  }
  logManager.setLevelRecursively(this, newLevel);
}

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

/**
 * Sets the parent of this logger in the namespace. This method should be
 * used by the {@code LogManager} object only.
 *
 * @param parent
 *            the parent logger to set.
 */
public void setParent(Logger parent) {
  if (parent == null) {
    throw new NullPointerException("parent == null");
  }
  // even anonymous loggers are checked
  LogManager logManager = LogManager.getLogManager();
  logManager.checkAccess();
  logManager.setParent(this, parent);
}

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

/**
 * Re-initialize the properties and configuration from the given
 * {@code InputStream}
 * <p>
 * Notice : No {@code PropertyChangeEvent} are fired.
 * </p>
 *
 * @param ins
 *            the input stream
 * @throws IOException
 *             if any IO related problems happened.
 */
public void readConfiguration(InputStream ins) throws IOException {
  checkAccess();
  readConfigurationImpl(ins);
}

代码示例来源: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

/**
 * Sets the output stream this handler writes to. If there's an existing
 * output stream, the tail string of the associated formatter will be
 * written to it. Then it will be flushed, closed and replaced with
 * {@code os}.
 *
 * @param os
 *            the new output stream.
 * @throws NullPointerException
 *             if {@code os} is {@code null}.
 */
protected void setOutputStream(OutputStream os) {
  if (os == null) {
    throw new NullPointerException("os == null");
  }
  LogManager.getLogManager().checkAccess();
  close(true);
  this.writer = null;
  this.os = os;
  this.writerNotInitialized = true;
}

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

private void init(String p, Boolean a, Integer l, Integer c)
    throws IOException {
  // check access
  manager = LogManager.getLogManager();
  manager.checkAccess();
  initProperties(p, a, l, c);
  initOutputFiles();
}

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

/**
 * Close this handler and target handler, free all associated resources.
 */
@Override
public void close() {
  manager.checkAccess();
  target.close();
  setLevel(Level.OFF);
}

相关文章