private void prepareAuditFile(Instant auditDate) throws IOException {
        ensureMaxTotalSize();

        // Rotate file if: we just started, current file size exceeded limit or date has changed
        if (currentAuditFile == null || currentAuditFile.length() > maxFileSize ||
                xmlWriter == null || currentDateLimit == null || auditDate.isAfter(currentDateLimit.atZone(JiveGlobals.getTimeZone().toZoneId()).toInstant()))
        {
            createAuditFile(auditDate);
        }
    }
Timer to save queued logs to the XML file.
xmppserver/src/main/java/org/jivesoftware/openfire/audit/spi/AuditorImpl.java