Class WriterHandler

    • Constructor Detail

      • WriterHandler

        public WriterHandler()
        Construct a new instance.
    • Method Detail

      • 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.
        Overrides:
        doPublish in class ExtHandler
        Parameters:
        record - the log record to publish
      • preWrite

        protected void preWrite​(ExtLogRecord record)
        Execute any pre-write policy, such as file rotation. The write lock is held during this method, so make it quick. The default implementation does nothing.
        Parameters:
        record - the record about to be logged
      • setWriter

        public void setWriter​(Writer writer)
        Set the writer. The writer will then belong to this handler; when the handler is closed or a new writer is set, this writer will be closed.
        Parameters:
        writer - the new writer, or null to disable logging
      • isCheckHeadEncoding

        public boolean isCheckHeadEncoding()
        Determine whether head encoding checking is turned on.
        Returns:
        true to check and report head encoding problems, or false to ignore them
      • setCheckHeadEncoding

        public WriterHandler setCheckHeadEncoding​(boolean checkHeadEncoding)
        Establish whether head encoding checking is turned on.
        Parameters:
        checkHeadEncoding - true to check and report head encoding problems, or false to ignore them
        Returns:
        this handler
      • isCheckTailEncoding

        public boolean isCheckTailEncoding()
        Determine whether tail encoding checking is turned on.
        Returns:
        true to check and report tail encoding problems, or false to ignore them
      • setCheckTailEncoding

        public WriterHandler setCheckTailEncoding​(boolean checkTailEncoding)
        Establish whether tail encoding checking is turned on.
        Parameters:
        checkTailEncoding - true to check and report tail encoding problems, or false to ignore them
        Returns:
        this handler
      • safeClose

        protected void safeClose​(Closeable c)
        Safely close the resource, reporting an error if the close fails.
        Parameters:
        c - the resource