Added message to dump log errors.

This commit is contained in:
Robin Kupper
2011-05-07 16:40:41 +02:00
parent 227747a377
commit c5cfa5fd87

View File

@@ -38,8 +38,14 @@ public class ClearLog implements Runnable
rs.next();
int deleted = rs.getInt(1);
if (deleted > 0) {
if (config.dumpDeletedLog)
state.execute("SELECT * FROM `" + table + "` WHERE date < '" + time + "' INTO OUTFILE '" + new File(dumpFolder, table + "-" + time + ".csv").getAbsolutePath().replace("\\", "\\\\") + "' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'");
if (config.dumpDeletedLog) {
try {
state.execute("SELECT * FROM `" + table + "` WHERE date < '" + time + "' INTO OUTFILE '" + new File(dumpFolder, table + "-" + time + ".csv").getAbsolutePath().replace("\\", "\\\\") + "' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'");
} catch (final SQLException ex) {
log.log(Level.SEVERE, "[LogBlock ClearLog] Error while dumping log. Make sure your MySQL user has access to the LogBLock folder, or disable clearlog.dumpDeletedLog.", ex);
return;
}
}
state.execute("DELETE FROM `" + table + "` WHERE date < '" + time + "'");
log.info("[LogBlock] Cleared out table " + table + ". Deleted " + deleted + " entries.");
}