From c5cfa5fd87404a2fb13f4987ffa15ac9ffd0b0b4 Mon Sep 17 00:00:00 2001 From: Robin Kupper Date: Sat, 7 May 2011 16:40:41 +0200 Subject: [PATCH] Added message to dump log errors. --- src/de/diddiz/LogBlock/ClearLog.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/de/diddiz/LogBlock/ClearLog.java b/src/de/diddiz/LogBlock/ClearLog.java index c714789..e92d9d0 100644 --- a/src/de/diddiz/LogBlock/ClearLog.java +++ b/src/de/diddiz/LogBlock/ClearLog.java @@ -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."); }