mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-27 05:00:08 +08:00
Corrected a logfile issue.
When WorldEdit is reloaded within Bukkit, an additional log file is created. This is because the Logger's FileHandler wasn't closed and thus kept the log file locked.
This commit is contained in:
parent
9f86c99a28
commit
d67e9d970d
@ -34,6 +34,7 @@
|
||||
public class BukkitConfiguration extends LocalConfiguration {
|
||||
private Configuration config;
|
||||
private Logger logger;
|
||||
private FileHandler logFileHandler;
|
||||
|
||||
public boolean noOpPermissions = false;
|
||||
|
||||
@ -97,9 +98,9 @@ public void load() {
|
||||
String logFile = config.getString("logging.file", "");
|
||||
if (!logFile.equals("")) {
|
||||
try {
|
||||
FileHandler handler = new FileHandler(logFile, true);
|
||||
handler.setFormatter(new LogFormat());
|
||||
logger.addHandler(handler);
|
||||
logFileHandler = new FileHandler(logFile, true);
|
||||
logFileHandler.setFormatter(new LogFormat());
|
||||
logger.addHandler(logFileHandler);
|
||||
} catch (IOException e) {
|
||||
logger.log(Level.WARNING, "Could not use log file " + logFile + ": "
|
||||
+ e.getMessage());
|
||||
@ -110,4 +111,11 @@ public void load() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void unload() {
|
||||
if (logFileHandler != null) {
|
||||
logFileHandler.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -111,6 +111,7 @@ public void onEnable() {
|
||||
*/
|
||||
public void onDisable() {
|
||||
controller.clearSessions();
|
||||
config.unload();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user