Openfire 3.9.3 and log rotation issue (based on date)

Hello all,

I am running Openfire 3.9.3 on a Solaris 10 (sparc) machine and I have an issue with log rotation. Logs are rotated based on size with no problem but they are being rotated based on date at noon instead of midnight. This means messages exchanged up to midday are logged on the previous day logfile. This is a considerable audit issue on our setup.

My locale and date settings are Europe/Dublin.

I’ve seen a log4j.xml file for the debug, info, warn, error log files but none for the logs that store message exchange (jive.*)

Where can I set/change the date for this rotation ?

I’ve searched on the forums and on multiple sources for a possible answer for my question but no luck so far.

Can anyone explain the log rotation based on date please ?



I found out why Openfire has this behaviour.

Had to look in the source code and found that this happens because they are using Calendar.HOUR (that takes values from 0-12) instead of Calendar.HOUR_OF_DAY (that takes values 0-23).

Here is the snipet from the guilty source code

org.jivesoftware.openfire.audit.spi.AuditorImpl ....
private void createAuditFile(Date auditDate) throws IOException {
        final String filePrefix = "jive.audit-" + dateFormat.format(auditDate) + "-";
        if (currentDateLimit == null || auditDate.after(currentDateLimit)) {
           // Set limit date after which we need to rollover the audit file (based on the date)
           Calendar calendar = Calendar.getInstance();
           calendar.set(Calendar.HOUR, 23);
           calendar.set(Calendar.MINUTE, 59);
           calendar.set(Calendar.SECOND, 59);
           calendar.set(Calendar.MILLISECOND, 999);
           currentDateLimit = calendar.getTime();
           filesIndex = 0;

Where we see


we should see


(line11 in the extraction above)

I changed the source, compiled and it is working properly now. I find it strange that no one else noticed this problem.

BTW I tested this on Solaris 10 (SPARC) with the following JDK :





Hope this helps someone else.