void register(Platform platform) { log.log(Level.FINE, "Registering commands with " + platform.getClass().getCanonicalName()); LocalConfiguration config = platform.getConfiguration(); boolean logging = config.logCommands; String path = config.logFile; // Register log if (!logging || path.isEmpty()) { dynamicHandler.setHandler(null); commandLog.setLevel(Level.OFF); } else { File file = new File(config.getWorkingDirectory(), path); commandLog.setLevel(Level.ALL); log.log(Level.INFO, "Logging WorldEdit commands to " + file.getAbsolutePath()); try { dynamicHandler.setHandler(new FileHandler(file.getAbsolutePath(), true)); } catch (IOException e) { log.log(Level.WARNING, "Could not use command log file " + path + ": " + e.getMessage()); } dynamicHandler.setFormatter(new LogFormat(config.logFormat)); } platform.registerCommands(dispatcher); }