Class FileAuditEndpoint

    • Field Detail

      • LINE_TERMINATOR

        private static final byte[] LINE_TERMINATOR
      • accepting

        private volatile boolean accepting
      • syncOnAccept

        private final boolean syncOnAccept
      • flushOnAccept

        private final boolean flushOnAccept
      • file

        private File file
      • clock

        protected final Clock clock
        Clock providing access to current time.
    • Method Detail

      • getFile

        File getFile()
      • safeClose

        private void safeClose​(Closeable c)
      • write

        void write​(byte[] bytes)
            throws IOException
        Method called to write given byte array to the target local file. This method can be overridden by subclasses to modify data written into file (to encrypt them for example), or just for counting amount of written bytes for needs of log rotation and similar. This method can be invoked only in synchronization block surrounding one log message processing.
        Parameters:
        bytes - the data to be written into the target local file
        Throws:
        IOException
      • preWrite

        void preWrite​(Instant instant)
        Method called before writing into local file. This method is NO-OP by default. It is intended to be overridden by subclasses which need to perform some operation before every writing into the target local file. This method can be invoked only in synchronization block surrounding one log message processing.
        Parameters:
        instant - time of the message acceptance
      • accept

        public void accept​(EventPriority priority,
                           String message)
                    throws IOException
        Accept formatted security event message to be processed written into target local file.
        Specified by:
        accept in interface org.wildfly.common.function.ExceptionBiConsumer<EventPriority,​String,​IOException>
        Parameters:
        priority - priority of the logged message
        message - the logged message
        Throws:
        IOException - when writing into the target local file fails
      • closeStreams

        void closeStreams()
                   throws IOException
        Close opened file streams. Can be called by subclasses for needs of target file changing. Must be called in synchronized block together with reopening using setFile().
        Throws:
        IOException