Merge pull request #98 from stoneLeaf/master

Corrected a logfile issue.
Dieser Commit ist enthalten in:
2011-05-07 22:47:33 -07:00
Commit 08daee3727
2 geänderte Dateien mit 13 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -34,6 +34,7 @@ import com.sk89q.worldedit.snapshots.SnapshotRepository;
public class BukkitConfiguration extends LocalConfiguration { public class BukkitConfiguration extends LocalConfiguration {
private Configuration config; private Configuration config;
private Logger logger; private Logger logger;
private FileHandler logFileHandler;
public boolean noOpPermissions = false; public boolean noOpPermissions = false;
@ -97,9 +98,9 @@ public class BukkitConfiguration extends LocalConfiguration {
String logFile = config.getString("logging.file", ""); String logFile = config.getString("logging.file", "");
if (!logFile.equals("")) { if (!logFile.equals("")) {
try { try {
FileHandler handler = new FileHandler(logFile, true); logFileHandler = new FileHandler(logFile, true);
handler.setFormatter(new LogFormat()); logFileHandler.setFormatter(new LogFormat());
logger.addHandler(handler); logger.addHandler(logFileHandler);
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.WARNING, "Could not use log file " + logFile + ": " logger.log(Level.WARNING, "Could not use log file " + logFile + ": "
+ e.getMessage()); + e.getMessage());
@ -110,4 +111,11 @@ public class BukkitConfiguration extends LocalConfiguration {
} }
} }
} }
public void unload() {
if (logFileHandler != null) {
logFileHandler.close();
}
}
} }

Datei anzeigen

@ -111,6 +111,7 @@ public class WorldEditPlugin extends JavaPlugin {
*/ */
public void onDisable() { public void onDisable() {
controller.clearSessions(); controller.clearSessions();
config.unload();
} }
/** /**
@ -118,6 +119,7 @@ public class WorldEditPlugin extends JavaPlugin {
*/ */
protected void loadConfiguration() { protected void loadConfiguration() {
getConfiguration().load(); getConfiguration().load();
config.unload();
config.load(); config.load();
perms.load(); perms.load();
} }