List of utility methods to do Log Rotate
void | rotateLog() rotate Log int maxLogs = 2; File last = new File("client-" + maxLogs + ".log"); if (last.exists()) { if (!last.delete()) { System.err.println("Error removing old log file:" + last); for (int i = maxLogs - 1; i > 0; i--) { ... |
void | rotateLogs(File where, String basename, int max) rotate Logs File logfile = new File(where, String.format("%s-%02d.log", basename, max)); if (logfile.exists()) { logfile.delete(); if (max > 0) { File previous = new File(where, String.format("%s-%02d.log", basename, max - 1)); if (previous.exists()) { previous.renameTo(logfile); ... |