Change some world server Logging to General (Level 1) debugging

This commit is contained in:
Akkadius 2015-01-21 19:15:36 -06:00
parent 9f25b52f9a
commit e1bfbfa30c

View File

@ -126,30 +126,30 @@ int main(int argc, char** argv) {
} }
// Load server configuration // Load server configuration
Log.Out(Logs::Detail, Logs::World_Server, "Loading server configuration.."); Log.Out(Logs::General, Logs::World_Server, "Loading server configuration..");
if (!WorldConfig::LoadConfig()) { if (!WorldConfig::LoadConfig()) {
Log.Out(Logs::Detail, Logs::World_Server, "Loading server configuration failed."); Log.Out(Logs::General, Logs::World_Server, "Loading server configuration failed.");
return 1; return 1;
} }
const WorldConfig *Config=WorldConfig::get(); const WorldConfig *Config=WorldConfig::get();
Log.Out(Logs::Detail, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); Log.Out(Logs::General, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
#ifdef _DEBUG #ifdef _DEBUG
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif #endif
if (signal(SIGINT, CatchSignal) == SIG_ERR) { if (signal(SIGINT, CatchSignal) == SIG_ERR) {
Log.Out(Logs::Detail, Logs::World_Server, "Could not set signal handler"); Log.Out(Logs::General, Logs::World_Server, "Could not set signal handler");
return 1; return 1;
} }
if (signal(SIGTERM, CatchSignal) == SIG_ERR) { if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
Log.Out(Logs::Detail, Logs::World_Server, "Could not set signal handler"); Log.Out(Logs::General, Logs::World_Server, "Could not set signal handler");
return 1; return 1;
} }
#ifndef WIN32 #ifndef WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
Log.Out(Logs::Detail, Logs::World_Server, "Could not set signal handler"); Log.Out(Logs::General, Logs::World_Server, "Could not set signal handler");
return 1; return 1;
} }
#endif #endif
@ -158,7 +158,7 @@ int main(int argc, char** argv) {
if (Config->LoginCount == 0) { if (Config->LoginCount == 0) {
if (Config->LoginHost.length()) { if (Config->LoginHost.length()) {
loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str()); loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str());
Log.Out(Logs::Detail, Logs::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); Log.Out(Logs::General, Logs::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort);
} }
} else { } else {
LinkedList<LoginConfig*> loginlist=Config->loginlist; LinkedList<LoginConfig*> loginlist=Config->loginlist;
@ -166,19 +166,19 @@ int main(int argc, char** argv) {
iterator.Reset(); iterator.Reset();
while(iterator.MoreElements()) { while(iterator.MoreElements()) {
loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str()); loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str());
Log.Out(Logs::Detail, Logs::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); Log.Out(Logs::General, Logs::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort);
iterator.Advance(); iterator.Advance();
} }
} }
Log.Out(Logs::Detail, Logs::World_Server, "Connecting to MySQL..."); Log.Out(Logs::General, Logs::World_Server, "Connecting to MySQL...");
if (!database.Connect( if (!database.Connect(
Config->DatabaseHost.c_str(), Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(), Config->DatabaseDB.c_str(),
Config->DatabasePort)) { Config->DatabasePort)) {
Log.Out(Logs::Detail, Logs::World_Server, "Cannot continue without a database connection."); Log.Out(Logs::General, Logs::World_Server, "Cannot continue without a database connection.");
return 1; return 1;
} }
guild_mgr.SetDatabase(&database); guild_mgr.SetDatabase(&database);
@ -278,56 +278,56 @@ int main(int argc, char** argv) {
} }
if(Config->WorldHTTPEnabled) { if(Config->WorldHTTPEnabled) {
Log.Out(Logs::Detail, Logs::World_Server, "Starting HTTP world service..."); Log.Out(Logs::General, Logs::World_Server, "Starting HTTP world service...");
http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str()); http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str());
} else { } else {
Log.Out(Logs::Detail, Logs::World_Server, "HTTP world service disabled."); Log.Out(Logs::General, Logs::World_Server, "HTTP world service disabled.");
} }
Log.Out(Logs::Detail, Logs::World_Server, "Checking Database Conversions.."); Log.Out(Logs::General, Logs::World_Server, "Checking Database Conversions..");
database.CheckDatabaseConversions(); database.CheckDatabaseConversions();
Log.Out(Logs::Detail, Logs::World_Server, "Loading variables.."); Log.Out(Logs::General, Logs::World_Server, "Loading variables..");
database.LoadVariables(); database.LoadVariables();
Log.Out(Logs::Detail, Logs::World_Server, "Loading zones.."); Log.Out(Logs::General, Logs::World_Server, "Loading zones..");
database.LoadZoneNames(); database.LoadZoneNames();
Log.Out(Logs::Detail, Logs::World_Server, "Clearing groups.."); Log.Out(Logs::General, Logs::World_Server, "Clearing groups..");
database.ClearGroup(); database.ClearGroup();
Log.Out(Logs::Detail, Logs::World_Server, "Clearing raids.."); Log.Out(Logs::General, Logs::World_Server, "Clearing raids..");
database.ClearRaid(); database.ClearRaid();
database.ClearRaidDetails(); database.ClearRaidDetails();
database.ClearRaidLeader(); database.ClearRaidLeader();
Log.Out(Logs::Detail, Logs::World_Server, "Loading items.."); Log.Out(Logs::General, Logs::World_Server, "Loading items..");
if (!database.LoadItems()) if (!database.LoadItems())
Log.Out(Logs::Detail, Logs::World_Server, "Error: Could not load item data. But ignoring"); Log.Out(Logs::General, Logs::World_Server, "Error: Could not load item data. But ignoring");
Log.Out(Logs::Detail, Logs::World_Server, "Loading skill caps.."); Log.Out(Logs::General, Logs::World_Server, "Loading skill caps..");
if (!database.LoadSkillCaps()) if (!database.LoadSkillCaps())
Log.Out(Logs::Detail, Logs::World_Server, "Error: Could not load skill cap data. But ignoring"); Log.Out(Logs::General, Logs::World_Server, "Error: Could not load skill cap data. But ignoring");
Log.Out(Logs::Detail, Logs::World_Server, "Loading guilds.."); Log.Out(Logs::General, Logs::World_Server, "Loading guilds..");
guild_mgr.LoadGuilds(); guild_mgr.LoadGuilds();
//rules: //rules:
{ {
char tmp[64]; char tmp[64];
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
Log.Out(Logs::Detail, Logs::World_Server, "Loading rule set '%s'", tmp); Log.Out(Logs::General, Logs::World_Server, "Loading rule set '%s'", tmp);
if(!RuleManager::Instance()->LoadRules(&database, tmp)) { if(!RuleManager::Instance()->LoadRules(&database, tmp)) {
Log.Out(Logs::Detail, Logs::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); Log.Out(Logs::General, Logs::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp);
} }
} else { } else {
if(!RuleManager::Instance()->LoadRules(&database, "default")) { if(!RuleManager::Instance()->LoadRules(&database, "default")) {
Log.Out(Logs::Detail, Logs::World_Server, "No rule set configured, using default rules"); Log.Out(Logs::General, Logs::World_Server, "No rule set configured, using default rules");
} else { } else {
Log.Out(Logs::Detail, Logs::World_Server, "Loaded default rule set 'default'", tmp); Log.Out(Logs::General, Logs::World_Server, "Loaded default rule set 'default'", tmp);
} }
} }
} }
if(RuleB(World, ClearTempMerchantlist)){ if(RuleB(World, ClearTempMerchantlist)){
Log.Out(Logs::Detail, Logs::World_Server, "Clearing temporary merchant lists.."); Log.Out(Logs::General, Logs::World_Server, "Clearing temporary merchant lists..");
database.ClearMerchantTemp(); database.ClearMerchantTemp();
} }
Log.Out(Logs::Detail, Logs::World_Server, "Loading EQ time of day.."); Log.Out(Logs::General, Logs::World_Server, "Loading EQ time of day..");
if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str())) if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str()))
Log.Out(Logs::Detail, Logs::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); Log.Out(Logs::General, Logs::World_Server, "Unable to load %s", Config->EQTimeFile.c_str());
Log.Out(Logs::Detail, Logs::World_Server, "Loading launcher list.."); Log.Out(Logs::General, Logs::World_Server, "Loading launcher list..");
launcher_list.LoadList(); launcher_list.LoadList();
char tmp[20]; char tmp[20];
@ -336,45 +336,45 @@ int main(int argc, char** argv) {
if ((strcasecmp(tmp, "1") == 0)) { if ((strcasecmp(tmp, "1") == 0)) {
holdzones = true; holdzones = true;
} }
Log.Out(Logs::Detail, Logs::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); Log.Out(Logs::General, Logs::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF");
Log.Out(Logs::Detail, Logs::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); Log.Out(Logs::General, Logs::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses());
Log.Out(Logs::Detail, Logs::World_Server, "Loading adventures..."); Log.Out(Logs::General, Logs::World_Server, "Loading adventures...");
if(!adventure_manager.LoadAdventureTemplates()) if(!adventure_manager.LoadAdventureTemplates())
{ {
Log.Out(Logs::Detail, Logs::World_Server, "Unable to load adventure templates."); Log.Out(Logs::General, Logs::World_Server, "Unable to load adventure templates.");
} }
if(!adventure_manager.LoadAdventureEntries()) if(!adventure_manager.LoadAdventureEntries())
{ {
Log.Out(Logs::Detail, Logs::World_Server, "Unable to load adventure templates."); Log.Out(Logs::General, Logs::World_Server, "Unable to load adventure templates.");
} }
adventure_manager.Load(); adventure_manager.Load();
adventure_manager.LoadLeaderboardInfo(); adventure_manager.LoadLeaderboardInfo();
Log.Out(Logs::Detail, Logs::World_Server, "Purging expired instances"); Log.Out(Logs::General, Logs::World_Server, "Purging expired instances");
database.PurgeExpiredInstances(); database.PurgeExpiredInstances();
Timer PurgeInstanceTimer(450000); Timer PurgeInstanceTimer(450000);
PurgeInstanceTimer.Start(450000); PurgeInstanceTimer.Start(450000);
Log.Out(Logs::Detail, Logs::World_Server, "Loading char create info..."); Log.Out(Logs::General, Logs::World_Server, "Loading char create info...");
database.LoadCharacterCreateAllocations(); database.LoadCharacterCreateAllocations();
database.LoadCharacterCreateCombos(); database.LoadCharacterCreateCombos();
char errbuf[TCPConnection_ErrorBufferSize]; char errbuf[TCPConnection_ErrorBufferSize];
if (tcps.Open(Config->WorldTCPPort, errbuf)) { if (tcps.Open(Config->WorldTCPPort, errbuf)) {
Log.Out(Logs::Detail, Logs::World_Server,"Zone (TCP) listener started."); Log.Out(Logs::General, Logs::World_Server,"Zone (TCP) listener started.");
} else { } else {
Log.Out(Logs::Detail, Logs::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); Log.Out(Logs::General, Logs::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort);
Log.Out(Logs::Detail, Logs::World_Server," %s",errbuf); Log.Out(Logs::General, Logs::World_Server," %s",errbuf);
return 1; return 1;
} }
if (eqsf.Open()) { if (eqsf.Open()) {
Log.Out(Logs::Detail, Logs::World_Server,"Client (UDP) listener started."); Log.Out(Logs::General, Logs::World_Server,"Client (UDP) listener started.");
} else { } else {
Log.Out(Logs::Detail, Logs::World_Server,"Failed to start client (UDP) listener (port 9000)"); Log.Out(Logs::General, Logs::World_Server,"Failed to start client (UDP) listener (port 9000)");
return 1; return 1;
} }
@ -402,7 +402,7 @@ int main(int argc, char** argv) {
//structures and opcodes for that patch. //structures and opcodes for that patch.
struct in_addr in; struct in_addr in;
in.s_addr = eqs->GetRemoteIP(); in.s_addr = eqs->GetRemoteIP();
Log.Out(Logs::Detail, Logs::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); Log.Out(Logs::General, Logs::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort()));
stream_identifier.AddStream(eqs); //takes the stream stream_identifier.AddStream(eqs); //takes the stream
} }
@ -415,19 +415,19 @@ int main(int argc, char** argv) {
struct in_addr in; struct in_addr in;
in.s_addr = eqsi->GetRemoteIP(); in.s_addr = eqsi->GetRemoteIP();
if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs. if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs.
Log.Out(Logs::Detail, Logs::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); Log.Out(Logs::General, Logs::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in));
if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table.
Log.Out(Logs::Detail, Logs::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); Log.Out(Logs::General, Logs::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
auto client = new Client(eqsi); auto client = new Client(eqsi);
// @merth: client->zoneattempt=0; // @merth: client->zoneattempt=0;
client_list.Add(client); client_list.Add(client);
} else { } else {
Log.Out(Logs::Detail, Logs::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); Log.Out(Logs::General, Logs::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream. eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream.
} }
} }
if (!RuleB(World, UseBannedIPsTable)){ if (!RuleB(World, UseBannedIPsTable)){
Log.Out(Logs::Detail, Logs::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); Log.Out(Logs::General, Logs::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
auto client = new Client(eqsi); auto client = new Client(eqsi);
// @merth: client->zoneattempt=0; // @merth: client->zoneattempt=0;
client_list.Add(client); client_list.Add(client);
@ -439,7 +439,7 @@ int main(int argc, char** argv) {
while ((tcpc = tcps.NewQueuePop())) { while ((tcpc = tcps.NewQueuePop())) {
struct in_addr in; struct in_addr in;
in.s_addr = tcpc->GetrIP(); in.s_addr = tcpc->GetrIP();
Log.Out(Logs::Detail, Logs::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); Log.Out(Logs::General, Logs::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort());
console_list.Add(new Console(tcpc)); console_list.Add(new Console(tcpc));
} }
@ -482,16 +482,16 @@ int main(int argc, char** argv) {
} }
Sleep(20); Sleep(20);
} }
Log.Out(Logs::Detail, Logs::World_Server, "World main loop completed."); Log.Out(Logs::General, Logs::World_Server, "World main loop completed.");
Log.Out(Logs::Detail, Logs::World_Server, "Shutting down console connections (if any)."); Log.Out(Logs::General, Logs::World_Server, "Shutting down console connections (if any).");
console_list.KillAll(); console_list.KillAll();
Log.Out(Logs::Detail, Logs::World_Server, "Shutting down zone connections (if any)."); Log.Out(Logs::General, Logs::World_Server, "Shutting down zone connections (if any).");
zoneserver_list.KillAll(); zoneserver_list.KillAll();
Log.Out(Logs::Detail, Logs::World_Server, "Zone (TCP) listener stopped."); Log.Out(Logs::General, Logs::World_Server, "Zone (TCP) listener stopped.");
tcps.Close(); tcps.Close();
Log.Out(Logs::Detail, Logs::World_Server, "Client (UDP) listener stopped."); Log.Out(Logs::General, Logs::World_Server, "Client (UDP) listener stopped.");
eqsf.Close(); eqsf.Close();
Log.Out(Logs::Detail, Logs::World_Server, "Signaling HTTP service to stop..."); Log.Out(Logs::General, Logs::World_Server, "Signaling HTTP service to stop...");
http_server.Stop(); http_server.Stop();
Log.CloseFileLogs(); Log.CloseFileLogs();
@ -499,9 +499,9 @@ int main(int argc, char** argv) {
} }
void CatchSignal(int sig_num) { void CatchSignal(int sig_num) {
Log.Out(Logs::Detail, Logs::World_Server,"Caught signal %d",sig_num); Log.Out(Logs::General, Logs::World_Server,"Caught signal %d",sig_num);
if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false) if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false)
Log.Out(Logs::Detail, Logs::World_Server,"Failed to save time file."); Log.Out(Logs::General, Logs::World_Server,"Failed to save time file.");
RunLoops = false; RunLoops = false;
} }