Class ExtHandler

    • Field Detail

      • handlers

        protected volatile Handler[] handlers
        The sub-handlers for this handler. May only be updated using the handlersUpdater atomic updater. The array instance should not be modified (treat as immutable).
      • handlersUpdater

        protected static final org.jboss.logmanager.AtomicArray<ExtHandler,​Handler> handlersUpdater
        The atomic updater for the handlers field.
    • Constructor Detail

      • ExtHandler

        protected ExtHandler()
        Construct a new instance.
    • Method Detail

      • publish

        public void publish​(ExtLogRecord record)
        Publish an ExtLogRecord.

        The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.

        The ExtHandler is responsible for formatting the message, when and if necessary. The formatting should include localization.

        Parameters:
        record - the log record to publish
      • publishToNestedHandlers

        protected void publishToNestedHandlers​(ExtLogRecord record)
        Publish a log record to each nested handler.
        Parameters:
        record - the log record to publish
      • doPublish

        protected void doPublish​(ExtLogRecord record)
        Do the actual work of publication; the record will have been filtered already. The default implementation does nothing except to flush if the autoFlush property is set to true; if this behavior is to be preserved in a subclass then this method should be called after the record is physically written.
        Parameters:
        record - the log record to publish
      • addHandler

        public void addHandler​(Handler handler)
        Add a sub-handler to this handler. Some handler types do not utilize sub-handlers.
        Parameters:
        handler - the handler to add
      • removeHandler

        public void removeHandler​(Handler handler)
                           throws SecurityException
        Remove a sub-handler from this handler. Some handler types do not utilize sub-handlers.
        Parameters:
        handler - the handler to remove
        Throws:
        SecurityException
      • getHandlers

        public Handler[] getHandlers()
        Get a copy of the sub-handlers array. Since the returned value is a copy, it may be freely modified.
        Returns:
        a copy of the sub-handlers array
      • setHandlers

        public Handler[] setHandlers​(Handler[] newHandlers)
                              throws SecurityException
        A convenience method to atomically get and replace the sub-handler array.
        Parameters:
        newHandlers - the new sub-handlers
        Returns:
        the old sub-handler array
        Throws:
        SecurityException
      • isAutoFlush

        public boolean isAutoFlush()
        Determine if this handler will auto-flush.
        Returns:
        true if auto-flush is enabled
      • setAutoFlush

        public void setAutoFlush​(boolean autoFlush)
                          throws SecurityException
        Change the autoflush setting for this handler.
        Parameters:
        autoFlush - true to automatically flush after each write; false otherwise
        Throws:
        SecurityException
      • setEnabled

        public final void setEnabled​(boolean enabled)
                              throws SecurityException
        Enables or disables the handler based on the value passed in.
        Parameters:
        enabled - true to enable the handler or false to disable the handler.
        Throws:
        SecurityException
      • isEnabled

        public final boolean isEnabled()
        Determine if the handler is enabled.
        Returns:
        true if the handler is enabled, otherwise false.
      • isCloseChildren

        public boolean isCloseChildren()
        Indicates whether or not children handlers should be closed when this handler is closed.
        Returns:
        true if the children handlers should be closed when this handler is closed, false if children handlers should not be closed when this handler is closed
      • setCloseChildren

        public void setCloseChildren​(boolean closeChildren)
        Sets whether or not children handlers should be closed when this handler is closed.
        Parameters:
        closeChildren - true if all children handlers should be closed when this handler is closed, false if children handlers will not be closed when this handler is closed
      • flush

        public void flush()
        Flush all child handlers.
        Specified by:
        flush in interface Flushable
        Specified by:
        flush in class Handler
      • reportError

        public static void reportError​(Handler handler,
                                       String msg,
                                       Exception ex,
                                       int code)
        Report an error using a handler's specific error manager, if any.
        Parameters:
        handler - the handler
        msg - the error message
        ex - the exception
        code - the error code