From c0b2237a12fc878ede8a8bbd48c9b4afa8290016 Mon Sep 17 00:00:00 2001 From: Keuin Date: Thu, 23 Apr 2020 23:27:33 +0800 Subject: Split Log4j --- .../java/com/keuin/kbackupfabric/worker/BackupWorker.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java') diff --git a/src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java b/src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java index 0ca9015..57e59fb 100644 --- a/src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java +++ b/src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java @@ -8,6 +8,8 @@ import com.mojang.brigadier.context.CommandContext; import net.minecraft.server.MinecraftServer; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.world.World; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.io.File; import java.io.IOException; @@ -15,7 +17,6 @@ import java.util.HashMap; import java.util.Map; import static com.keuin.kbackupfabric.util.BackupFilesystemUtil.*; -import static com.keuin.kbackupfabric.util.PrintUtil.debug; import static com.keuin.kbackupfabric.util.PrintUtil.msgInfo; /** @@ -23,6 +24,8 @@ import static com.keuin.kbackupfabric.util.PrintUtil.msgInfo; * To invoke this worker, simply call invoke() method. */ public final class BackupWorker implements Runnable { + + private static final Logger LOGGER = LogManager.getLogger(); private final CommandContext context; private final String backupName; private final Map oldWorldsSavingDisabled; @@ -53,9 +56,9 @@ public final class BackupWorker implements Runnable { }); // Force to save all player data and worlds - debug("Saving players ..."); + LOGGER.debug("Saving players ..."); server.getPlayerManager().saveAllPlayerData(); - debug("Saving worlds ..."); + LOGGER.debug("Saving worlds ..."); server.save(true, true, true); // Start threaded worker @@ -82,7 +85,7 @@ public final class BackupWorker implements Runnable { // Make zip String levelPath = getLevelPath(server); String backupFileName = getBackupFileName(backupName); - debug(String.format("zip(srcPath=%s, destPath=%s)", levelPath, backupSaveDirectoryFile.toString())); + LOGGER.debug(String.format("zip(srcPath=%s, destPath=%s)", levelPath, backupSaveDirectoryFile.toString())); ZipUtil.makeBackupZip(levelPath, backupSaveDirectoryFile.toString(), backupFileName, backupMetadata); File backupZipFile = new File(backupSaveDirectoryFile, backupFileName); -- cgit v1.2.3