mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
* Removed the LogServices (H2 DB file that logs actions).
This commit is contained in:
parent
6598e6cc7f
commit
e1ca3b5cc5
5 changed files with 0 additions and 58 deletions
|
@ -1,6 +1,5 @@
|
||||||
XMage.de 1 (Europe/Germany) fast :xmage.de:17171
|
XMage.de 1 (Europe/Germany) fast :xmage.de:17171
|
||||||
woogerworks (North America/USA) :xmage.woogerworks.com:17171
|
woogerworks (North America/USA) :xmage.woogerworks.com:17171
|
||||||
woogerworks replacment (North America/USA) :158.69.192.238:17171
|
|
||||||
XMage.tahiti :xmage.tahiti.one:443
|
XMage.tahiti :xmage.tahiti.one:443
|
||||||
Seedds Server (Asia) :115.29.203.80:17171
|
Seedds Server (Asia) :115.29.203.80:17171
|
||||||
localhost -> connect to your local server (must be started):localhost:17171
|
localhost -> connect to your local server (must be started):localhost:17171
|
||||||
|
|
|
@ -68,9 +68,7 @@ import mage.server.game.GamesRoom;
|
||||||
import mage.server.game.GamesRoomManager;
|
import mage.server.game.GamesRoomManager;
|
||||||
import mage.server.game.PlayerFactory;
|
import mage.server.game.PlayerFactory;
|
||||||
import mage.server.game.ReplayManager;
|
import mage.server.game.ReplayManager;
|
||||||
import mage.server.services.LogKeys;
|
|
||||||
import mage.server.services.impl.FeedbackServiceImpl;
|
import mage.server.services.impl.FeedbackServiceImpl;
|
||||||
import mage.server.services.impl.LogServiceImpl;
|
|
||||||
import mage.server.tournament.TournamentFactory;
|
import mage.server.tournament.TournamentFactory;
|
||||||
import mage.server.tournament.TournamentManager;
|
import mage.server.tournament.TournamentManager;
|
||||||
import mage.server.util.ConfigSettings;
|
import mage.server.util.ConfigSettings;
|
||||||
|
@ -188,7 +186,6 @@ public class MageServerImpl implements MageServer {
|
||||||
public boolean registerClient(String userName, String sessionId, MageVersion version) throws MageException {
|
public boolean registerClient(String userName, String sessionId, MageVersion version) throws MageException {
|
||||||
// This method is deprecated, so just inform the server version.
|
// This method is deprecated, so just inform the server version.
|
||||||
logger.info("MageVersionException: userName=" + userName + ", version=" + version);
|
logger.info("MageVersionException: userName=" + userName + ", version=" + version);
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_WRONG_VERSION, userName, version.toString(), Main.getVersion().toString(), sessionId);
|
|
||||||
throw new MageVersionException(version, Main.getVersion());
|
throw new MageVersionException(version, Main.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +194,6 @@ public class MageServerImpl implements MageServer {
|
||||||
try {
|
try {
|
||||||
if (version.compareTo(Main.getVersion()) != 0) {
|
if (version.compareTo(Main.getVersion()) != 0) {
|
||||||
logger.info("MageVersionException: userName=" + userName + ", version=" + version);
|
logger.info("MageVersionException: userName=" + userName + ", version=" + version);
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_WRONG_VERSION, userName, version.toString(), Main.getVersion().toString(), sessionId);
|
|
||||||
throw new MageVersionException(version, Main.getVersion());
|
throw new MageVersionException(version, Main.getVersion());
|
||||||
}
|
}
|
||||||
return SessionManager.getInstance().connectUser(sessionId, userName, password);
|
return SessionManager.getInstance().connectUser(sessionId, userName, password);
|
||||||
|
@ -266,7 +262,6 @@ public class MageServerImpl implements MageServer {
|
||||||
logger.debug("- " + user.getName() + " userId: " + user.getId());
|
logger.debug("- " + user.getName() + " userId: " + user.getId());
|
||||||
logger.debug("- chatId: " + TableManager.getInstance().getChatId(table.getTableId()));
|
logger.debug("- chatId: " + TableManager.getInstance().getChatId(table.getTableId()));
|
||||||
}
|
}
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_TABLE_CREATED, sessionId, userId.toString(), table.getTableId().toString());
|
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -315,7 +310,6 @@ public class MageServerImpl implements MageServer {
|
||||||
}
|
}
|
||||||
TableView table = GamesRoomManager.getInstance().getRoom(roomId).createTournamentTable(userId, options);
|
TableView table = GamesRoomManager.getInstance().getRoom(roomId).createTournamentTable(userId, options);
|
||||||
logger.debug("Tournament table " + table.getTableId() + " created");
|
logger.debug("Tournament table " + table.getTableId() + " created");
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_TOURNAMENT_TABLE_CREATED, sessionId, userId.toString(), table.getTableId().toString());
|
|
||||||
return table;
|
return table;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
handleException(ex);
|
handleException(ex);
|
||||||
|
@ -1190,7 +1184,6 @@ public class MageServerImpl implements MageServer {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
String host = SessionManager.getInstance().getSession(sessionId).getHost();
|
String host = SessionManager.getInstance().getSession(sessionId).getHost();
|
||||||
FeedbackServiceImpl.instance.feedback(username, title, type, message, email, host);
|
FeedbackServiceImpl.instance.feedback(username, title, type, message, email, host);
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_FEEDBACK_ADDED, sessionId, username, host);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1226,7 +1219,6 @@ public class MageServerImpl implements MageServer {
|
||||||
protected void execute(final String actionName, final String sessionId, final Action action, boolean checkAdminRights) throws MageException {
|
protected void execute(final String actionName, final String sessionId, final Action action, boolean checkAdminRights) throws MageException {
|
||||||
if (checkAdminRights) {
|
if (checkAdminRights) {
|
||||||
if (!SessionManager.getInstance().isAdmin(sessionId)) {
|
if (!SessionManager.getInstance().isAdmin(sessionId)) {
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_NOT_ADMIN, actionName, sessionId);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1246,8 +1238,6 @@ public class MageServerImpl implements MageServer {
|
||||||
} catch (MageException me) {
|
} catch (MageException me) {
|
||||||
throw new RuntimeException(me);
|
throw new RuntimeException(me);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_NOT_VALID_SESSION_INTERNAL, actionName, sessionId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1255,15 +1245,12 @@ public class MageServerImpl implements MageServer {
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
handleException(ex);
|
handleException(ex);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_NOT_VALID_SESSION, actionName, sessionId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T> T executeWithResult(String actionName, final String sessionId, final ActionWithResult<T> action, boolean checkAdminRights) throws MageException {
|
protected <T> T executeWithResult(String actionName, final String sessionId, final ActionWithResult<T> action, boolean checkAdminRights) throws MageException {
|
||||||
if (checkAdminRights) {
|
if (checkAdminRights) {
|
||||||
if (!SessionManager.getInstance().isAdmin(sessionId)) {
|
if (!SessionManager.getInstance().isAdmin(sessionId)) {
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_NOT_ADMIN, actionName, sessionId);
|
|
||||||
return action.negativeResult();
|
return action.negativeResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1278,8 +1265,6 @@ public class MageServerImpl implements MageServer {
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
handleException(ex);
|
handleException(ex);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_NOT_VALID_SESSION, actionName, sessionId);
|
|
||||||
}
|
}
|
||||||
return action.negativeResult();
|
return action.negativeResult();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,6 @@ import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import mage.MageException;
|
import mage.MageException;
|
||||||
import mage.players.net.UserData;
|
import mage.players.net.UserData;
|
||||||
import mage.server.services.LogKeys;
|
|
||||||
import mage.server.services.impl.LogServiceImpl;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.jboss.remoting.callback.InvokerCallbackHandler;
|
import org.jboss.remoting.callback.InvokerCallbackHandler;
|
||||||
|
|
||||||
|
@ -81,8 +79,6 @@ public class SessionManager {
|
||||||
logger.debug(userName + " not registered: " + returnMessage);
|
logger.debug(userName + " not registered: " + returnMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_USER_REGISTERED, userName, session.getHost(), sessionId);
|
|
||||||
|
|
||||||
logger.info(userName + " registered");
|
logger.info(userName + " registered");
|
||||||
logger.debug("- userId: " + session.getUserId());
|
logger.debug("- userId: " + session.getUserId());
|
||||||
logger.debug("- sessionId: " + sessionId);
|
logger.debug("- sessionId: " + sessionId);
|
||||||
|
@ -95,8 +91,6 @@ public class SessionManager {
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
String returnMessage = session.connectUser(userName, password);
|
String returnMessage = session.connectUser(userName, password);
|
||||||
if (returnMessage == null) {
|
if (returnMessage == null) {
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_USER_CONNECTED, userName, session.getHost(), sessionId);
|
|
||||||
|
|
||||||
logger.info(userName + " connected to server");
|
logger.info(userName + " connected to server");
|
||||||
logger.debug("- userId: " + session.getUserId());
|
logger.debug("- userId: " + session.getUserId());
|
||||||
logger.debug("- sessionId: " + sessionId);
|
logger.debug("- sessionId: " + sessionId);
|
||||||
|
@ -115,7 +109,6 @@ public class SessionManager {
|
||||||
Session session = sessions.get(sessionId);
|
Session session = sessions.get(sessionId);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
session.connectAdmin();
|
session.connectAdmin();
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_ADMIN_CONNECTED, "Admin", session.getHost(), sessionId);
|
|
||||||
logger.info("Admin connected from " + session.getHost());
|
logger.info("Admin connected from " + session.getHost());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -144,15 +137,12 @@ public class SessionManager {
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case Disconnected:
|
case Disconnected:
|
||||||
session.kill(reason);
|
session.kill(reason);
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_SESSION_KILLED, sessionId);
|
|
||||||
break;
|
break;
|
||||||
case SessionExpired:
|
case SessionExpired:
|
||||||
session.kill(reason);
|
session.kill(reason);
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_SESSION_EXPIRED, sessionId);
|
|
||||||
break;
|
break;
|
||||||
case LostConnection:
|
case LostConnection:
|
||||||
session.userLostConnection();
|
session.userLostConnection();
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_SESSION_DISCONNECTED, sessionId);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logger.error("endSession: unexpected reason " + reason.toString() + " - sessionId: " + sessionId);
|
logger.error("endSession: unexpected reason " + reason.toString() + " - sessionId: " + sessionId);
|
||||||
|
@ -187,7 +177,6 @@ public class SessionManager {
|
||||||
user.showUserMessage("Admin operation", "Your session was disconnected by Admin.");
|
user.showUserMessage("Admin operation", "Your session was disconnected by Admin.");
|
||||||
userAdmin.showUserMessage("Admin action", "User" + user.getName() + " was disconnected.");
|
userAdmin.showUserMessage("Admin action", "User" + user.getName() + " was disconnected.");
|
||||||
disconnect(userSessionId, DisconnectReason.AdminDisconnect);
|
disconnect(userSessionId, DisconnectReason.AdminDisconnect);
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_SESSION_DISCONNECTED_BY_ADMIN, sessionId, userSessionId);
|
|
||||||
} else {
|
} else {
|
||||||
userAdmin.showUserMessage("Admin operation", "User with sessionId " + userSessionId + " could not be found!");
|
userAdmin.showUserMessage("Admin operation", "User with sessionId " + userSessionId + " could not be found!");
|
||||||
}
|
}
|
||||||
|
@ -206,7 +195,6 @@ public class SessionManager {
|
||||||
public void endUserSession(String sessionId, String userSessionId) {
|
public void endUserSession(String sessionId, String userSessionId) {
|
||||||
if (isAdmin(sessionId)) {
|
if (isAdmin(sessionId)) {
|
||||||
disconnect(userSessionId, DisconnectReason.AdminDisconnect);
|
disconnect(userSessionId, DisconnectReason.AdminDisconnect);
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_SESSION_END_BY_ADMIN, sessionId, userSessionId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,6 @@ import mage.server.game.GameFactory;
|
||||||
import mage.server.game.GameManager;
|
import mage.server.game.GameManager;
|
||||||
import mage.server.game.PlayerFactory;
|
import mage.server.game.PlayerFactory;
|
||||||
import mage.server.record.TableRecorderImpl;
|
import mage.server.record.TableRecorderImpl;
|
||||||
import mage.server.services.LogKeys;
|
|
||||||
import mage.server.services.impl.LogServiceImpl;
|
|
||||||
import mage.server.tournament.TournamentController;
|
import mage.server.tournament.TournamentController;
|
||||||
import mage.server.tournament.TournamentFactory;
|
import mage.server.tournament.TournamentFactory;
|
||||||
import mage.server.tournament.TournamentManager;
|
import mage.server.tournament.TournamentManager;
|
||||||
|
@ -606,7 +604,6 @@ public class TableController {
|
||||||
if (match.getGame() != null) {
|
if (match.getGame() != null) {
|
||||||
logger.debug("- chatId: " + GameManager.getInstance().getChatId(match.getGame().getId()));
|
logger.debug("- chatId: " + GameManager.getInstance().getChatId(match.getGame().getId()));
|
||||||
}
|
}
|
||||||
LogServiceImpl.instance.log(LogKeys.KEY_GAME_STARTED, String.valueOf(userPlayerMap.size()), creator, opponent.toString());
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.fatal("Error starting game table: " + table.getId(), ex);
|
logger.fatal("Error starting game table: " + table.getId(), ex);
|
||||||
if (table != null) {
|
if (table != null) {
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
package mage.server.services.impl;
|
|
||||||
|
|
||||||
import mage.db.EntityManager;
|
|
||||||
import mage.server.services.LogService;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author noxx
|
|
||||||
*/
|
|
||||||
public enum LogServiceImpl implements LogService {
|
|
||||||
instance;
|
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(LogServiceImpl.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void log(String key, String... args) {
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
try {
|
|
||||||
EntityManager.instance.insertLog(key, cal.getTime(), args);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.fatal(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue