/** * 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); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; } }
/** * 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); }
/** * 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; }
/** * 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; } }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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(); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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(); }
/** * 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(); }
/** * 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; }
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(); }
/** * Close this handler and target handler, free all associated resources. */ @Override public void close() { manager.checkAccess(); target.close(); setLevel(Level.OFF); }