mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-04 21:45:27 +02:00
Make mcMMO quieter by moving most log messages to debug only
This commit is contained in:
@@ -2,6 +2,7 @@ package com.gmail.nossr50.database;
|
||||
|
||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -16,14 +17,14 @@ public class DatabaseManagerFactory {
|
||||
return createDefaultCustomDatabaseManager();
|
||||
}
|
||||
catch (Exception e) {
|
||||
mcMMO.p.debug("Could not create custom database manager");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Could not create custom database manager");
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
mcMMO.p.debug("Failed to create custom database manager");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Failed to create custom database manager");
|
||||
e.printStackTrace();
|
||||
}
|
||||
mcMMO.p.debug("Falling back on " + (mcMMO.p.getGeneralConfig().getUseMySQL() ? "SQL" : "Flatfile") + " database");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Falling back on " + (mcMMO.p.getGeneralConfig().getUseMySQL() ? "SQL" : "Flatfile") + " database");
|
||||
}
|
||||
|
||||
return mcMMO.p.getGeneralConfig().getUseMySQL() ? new SQLDatabaseManager() : new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel);
|
||||
@@ -62,16 +63,16 @@ public class DatabaseManagerFactory {
|
||||
public static @Nullable DatabaseManager createDatabaseManager(@NotNull DatabaseType type, @NotNull String userFilePath, @NotNull Logger logger, long purgeTime, int startingLevel) {
|
||||
switch (type) {
|
||||
case FLATFILE:
|
||||
mcMMO.p.getLogger().info("Using FlatFile Database");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Using FlatFile Database");
|
||||
return new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel);
|
||||
|
||||
case SQL:
|
||||
mcMMO.p.getLogger().info("Using SQL Database");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Using SQL Database");
|
||||
return new SQLDatabaseManager();
|
||||
|
||||
case CUSTOM:
|
||||
try {
|
||||
mcMMO.p.getLogger().info("Attempting to use Custom Database");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Attempting to use Custom Database");
|
||||
return createDefaultCustomDatabaseManager();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
|
@@ -9,6 +9,7 @@ import com.gmail.nossr50.datatypes.player.UniqueDataType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.skills.SkillTools;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -115,7 +116,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
||||
public int purgePowerlessUsers() {
|
||||
int purgedUsers = 0;
|
||||
|
||||
logger.info("Purging powerless users...");
|
||||
LogUtils.debug(logger, "Purging powerless users...");
|
||||
|
||||
BufferedReader in = null;
|
||||
FileWriter out = null;
|
||||
@@ -183,7 +184,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
||||
int removedPlayers = 0;
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
logger.info("Purging old users...");
|
||||
LogUtils.debug(logger, "Purging old users...");
|
||||
|
||||
BufferedReader in = null;
|
||||
FileWriter out = null;
|
||||
@@ -715,7 +716,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
||||
boolean matchingName = dbPlayerName.equalsIgnoreCase(playerName);
|
||||
|
||||
if (!matchingName) {
|
||||
logger.info("When loading user: "+playerName +" with UUID of (" + uuid.toString()
|
||||
logger.warning("When loading user: "+playerName +" with UUID of (" + uuid.toString()
|
||||
+") we found a mismatched name, the name in the DB will be replaced (DB name: "+dbPlayerName+")");
|
||||
//logger.info("Name updated for player: " + rawSplitData[USERNAME_INDEX] + " => " + playerName);
|
||||
rawSplitData[USERNAME_INDEX] = playerName;
|
||||
@@ -840,7 +841,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
||||
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
||||
}
|
||||
finally {
|
||||
logger.info(i + " entries written while saving UUID for " + userName);
|
||||
LogUtils.debug(logger, i + " entries written while saving UUID for " + userName);
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
@@ -898,7 +899,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
||||
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
||||
}
|
||||
finally {
|
||||
logger.info(i + " entries written while saving UUID batch");
|
||||
LogUtils.debug(logger, i + " entries written while saving UUID batch");
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
@@ -1092,7 +1093,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
||||
|
||||
public @Nullable List<FlatFileDataFlag> checkFileHealthAndStructure() {
|
||||
ArrayList<FlatFileDataFlag> flagsFound = null;
|
||||
logger.info("(" + usersFile.getPath() + ") Validating database file..");
|
||||
LogUtils.debug(logger, "(" + usersFile.getPath() + ") Validating database file..");
|
||||
FlatFileDataProcessor dataProcessor = null;
|
||||
|
||||
if (usersFile.exists()) {
|
||||
@@ -1127,7 +1128,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
||||
//Only update the file if needed
|
||||
if(dataProcessor.getFlatFileDataFlags().size() > 0) {
|
||||
flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags());
|
||||
logger.info("Saving the updated and or repaired FlatFile Database...");
|
||||
logger.info("Updating FlatFile Database...");
|
||||
fileWriter = new FileWriter(usersFilePath);
|
||||
//Write data to file
|
||||
if(dbCommentDate != null)
|
||||
|
@@ -11,6 +11,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.skills.SkillTools;
|
||||
import org.apache.tomcat.jdbc.pool.DataSource;
|
||||
@@ -1013,7 +1014,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
*/
|
||||
private void checkDatabaseStructure(Connection connection, UpgradeType upgrade) {
|
||||
if (!mcMMO.getUpgradeManager().shouldUpgrade(upgrade)) {
|
||||
mcMMO.p.debug("Skipping " + upgrade.name() + " upgrade (unneeded)");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Skipping " + upgrade.name() + " upgrade (unneeded)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1577,7 +1578,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
mcMMO.p.debug("Releasing connection pool resource...");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Releasing connection pool resource...");
|
||||
miscPool.close();
|
||||
loadPool.close();
|
||||
savePool.close();
|
||||
|
Reference in New Issue
Block a user