Add debug statements for finding the source of #419

This commit is contained in:
games647 2016-05-11 16:55:22 +02:00
parent 3f5154e3c7
commit 4bad04b160
3 changed files with 17 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package fr.xephi.authme; package fr.xephi.authme;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.util.StringUtils; import fr.xephi.authme.util.StringUtils;
import java.io.File; import java.io.File;
@ -48,6 +49,15 @@ public final class ConsoleLogger {
} }
} }
public static void debug(String message) {
if (!AuthMe.getInstance().getSettings().getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
logger.fine(message);
if (useLogging) {
writeLog("Debug: " + message);
}
}
}
/** /**
* Print an error message. * Print an error message.
* *

View File

@ -1,5 +1,7 @@
package fr.xephi.authme.cache.auth; package fr.xephi.authme.cache.auth;
import fr.xephi.authme.ConsoleLogger;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
@ -22,6 +24,7 @@ public class PlayerCache {
if (singleton == null) { if (singleton == null) {
singleton = new PlayerCache(); singleton = new PlayerCache();
} }
return singleton; return singleton;
} }
@ -31,6 +34,7 @@ public class PlayerCache {
* @param auth PlayerAuth * @param auth PlayerAuth
*/ */
public void addPlayer(PlayerAuth auth) { public void addPlayer(PlayerAuth auth) {
ConsoleLogger.debug("ADDED PLAYER TO CACHE " + auth.getNickname());
cache.put(auth.getNickname().toLowerCase(), auth); cache.put(auth.getNickname().toLowerCase(), auth);
} }
@ -40,6 +44,7 @@ public class PlayerCache {
* @param auth PlayerAuth * @param auth PlayerAuth
*/ */
public void updatePlayer(PlayerAuth auth) { public void updatePlayer(PlayerAuth auth) {
ConsoleLogger.debug("UPDATE PLAYER " + auth.getNickname());
cache.put(auth.getNickname(), auth); cache.put(auth.getNickname(), auth);
} }
@ -49,6 +54,7 @@ public class PlayerCache {
* @param user String * @param user String
*/ */
public void removePlayer(String user) { public void removePlayer(String user) {
ConsoleLogger.debug("REMOVE PLAYER " + user);
cache.remove(user.toLowerCase()); cache.remove(user.toLowerCase());
} }

View File

@ -53,6 +53,7 @@ public class CacheDataSource implements DataSource {
return executorService.submit(new Callable<Optional<PlayerAuth>>() { return executorService.submit(new Callable<Optional<PlayerAuth>>() {
@Override @Override
public Optional<PlayerAuth> call() { public Optional<PlayerAuth> call() {
ConsoleLogger.debug("REFRESH " + key);
return load(key); return load(key);
} }
}); });