diff options
| author | Subv <s.v.h21@hotmail.com> | 2012-08-07 13:44:22 -0500 |
|---|---|---|
| committer | Subv <s.v.h21@hotmail.com> | 2012-08-07 13:44:22 -0500 |
| commit | d82266bc0ef31df82dc67c1023d6208df6ac247b (patch) | |
| tree | a0c5970a82e568ca54a25809555b7abad52e1bc1 /src/server/authserver | |
| parent | 224cf663e2af8b355b4bdca4069080636321b0ba (diff) | |
| parent | f8cd39b2ed1056f409c2690ac8bb661fbcb68e18 (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/authserver/Server/AuthSocket.cpp
src/server/game/Achievements/AchievementMgr.cpp
src/server/game/Chat/Chat.h
src/server/game/Chat/Commands/Level1.cpp
src/server/game/Chat/Commands/Level2.cpp
src/server/game/Chat/Commands/Level3.cpp
src/server/game/DataStores/DBCStores.cpp
src/server/game/DataStores/DBCStructure.h
src/server/game/Entities/Object/Object.cpp
src/server/game/Entities/Object/Updates/UpdateData.cpp
src/server/game/Entities/Player/Player.cpp
src/server/game/Globals/ObjectMgr.cpp
src/server/game/Guilds/Guild.cpp
src/server/game/Guilds/GuildMgr.cpp
src/server/game/Handlers/AuctionHouseHandler.cpp
src/server/game/Handlers/CharacterHandler.cpp
src/server/game/Handlers/ChatHandler.cpp
src/server/game/Handlers/GroupHandler.cpp
src/server/game/Handlers/ItemHandler.cpp
src/server/game/Handlers/MailHandler.cpp
src/server/game/Handlers/MiscHandler.cpp
src/server/game/Handlers/MovementHandler.cpp
src/server/game/Handlers/PetHandler.cpp
src/server/game/Handlers/QuestHandler.cpp
src/server/game/Handlers/VehicleHandler.cpp
src/server/game/Server/WorldSession.cpp
src/server/game/Server/WorldSocket.cpp
src/server/game/Spells/Auras/SpellAuraEffects.cpp
src/server/game/Spells/SpellEffects.cpp
src/server/game/Spells/SpellMgr.cpp
src/server/game/World/World.cpp
src/server/scripts/Commands/cs_debug.cpp
src/server/scripts/Commands/cs_modify.cpp
src/server/scripts/Commands/cs_reload.cpp
src/server/scripts/Kalimdor/azuremyst_isle.cpp
src/server/shared/Logging/Log.cpp
src/server/shared/Logging/Log.h
src/server/worldserver/worldserver.conf.dist
Diffstat (limited to 'src/server/authserver')
| -rwxr-xr-x | src/server/authserver/Main.cpp | 71 | ||||
| -rwxr-xr-x | src/server/authserver/Realms/RealmList.cpp | 4 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/server/authserver/Server/AuthSocket.cpp | 76 | ||||
| -rwxr-xr-x | src/server/authserver/Server/RealmAcceptor.h | 4 | ||||
| -rwxr-xr-x | src/server/authserver/Server/RealmSocket.cpp | 2 | ||||
| -rw-r--r-- | src/server/authserver/authserver.conf.dist | 212 |
6 files changed, 173 insertions, 196 deletions
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 01a33d836d6..f5a3c7cf7e1 100755 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -63,7 +63,7 @@ public: /// Print out the usage string for this program on the console. void usage(const char *prog) { - sLog->outString("Usage: \n %s [<options>]\n" + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Usage: \n %s [<options>]\n" " -c config_file use config_file as configuration file\n\r", prog); } @@ -71,7 +71,6 @@ void usage(const char *prog) // Launch the auth server extern int main(int argc, char **argv) { - sLog->SetLogDB(false); // Command line parsing to get the configuration file name char const* cfg_file = _TRINITY_REALM_CONFIG; int c = 1; @@ -81,7 +80,7 @@ extern int main(int argc, char **argv) { if (++c >= argc) { - sLog->outError("Runtime-Error: -c option requires an input argument"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Runtime-Error: -c option requires an input argument"); usage(argv[0]); return 1; } @@ -93,17 +92,16 @@ extern int main(int argc, char **argv) if (!ConfigMgr::Load(cfg_file)) { - sLog->outError("Invalid or missing configuration file : %s", cfg_file); - sLog->outError("Verify that the file exists and has \'[authserver]\' written in the top of the file!"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Invalid or missing configuration file : %s", cfg_file); + sLog->outError(LOG_FILTER_AUTHSERVER, "Verify that the file exists and has \'[authserver]\' written in the top of the file!"); return 1; } - sLog->Initialize(); - sLog->outString("%s (authserver)", _FULLVERSION); - sLog->outString("<Ctrl-C> to stop.\n"); - sLog->outString("Using configuration file %s.", cfg_file); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "%s (authserver)", _FULLVERSION); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "<Ctrl-C> to stop.\n"); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using configuration file %s.", cfg_file); - sLog->outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); + sLog->outWarn(LOG_FILTER_AUTHSERVER, "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true); @@ -111,7 +109,7 @@ extern int main(int argc, char **argv) ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true); #endif - sLog->outBasic("Max allowed open files is %d", ACE::max_handles()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Max allowed open files is %d", ACE::max_handles()); // authserver PID file creation std::string pidfile = ConfigMgr::GetStringDefault("PidFile", ""); @@ -120,27 +118,23 @@ extern int main(int argc, char **argv) uint32 pid = CreatePIDFile(pidfile); if (!pid) { - sLog->outError("Cannot create PID file %s.\n", pidfile.c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidfile.c_str()); return 1; } - - sLog->outString("Daemon PID: %u\n", pid); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid); } // Initialize the database connection if (!StartDB()) return 1; - // Initialize the log database - sLog->SetLogDBLater(ConfigMgr::GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished. - sLog->SetLogDB(false); sLog->SetRealmID(0); // ensure we've set realm to 0 (authserver realmid) // Get the list of realms for the server sRealmList->Initialize(ConfigMgr::GetIntDefault("RealmsStateUpdateDelay", 20)); if (sRealmList->size() == 0) { - sLog->outError("No valid realms specified."); + sLog->outError(LOG_FILTER_AUTHSERVER, "No valid realms specified."); return 1; } @@ -154,7 +148,7 @@ extern int main(int argc, char **argv) if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1) { - sLog->outError("Auth server can not bind to %s:%d", bind_ip.c_str(), rmport); + sLog->outError(LOG_FILTER_AUTHSERVER, "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport); return 1; } @@ -182,13 +176,13 @@ extern int main(int argc, char **argv) ULONG_PTR curAff = Aff & appAff; // remove non accessible processors if (!curAff) - sLog->outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff); + sLog->outError(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff); else if (SetProcessAffinityMask(hProcess, curAff)) - sLog->outString("Using processors (bitmask, hex): %x", curAff); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", curAff); else - sLog->outError("Can't set used processors (hex): %x", curAff); + sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", curAff); } - sLog->outString(); + } bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false); @@ -196,10 +190,10 @@ extern int main(int argc, char **argv) if (Prio) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - sLog->outString("The auth server process priority class has been set to HIGH"); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "The auth server process priority class has been set to HIGH"); else - sLog->outError("Can't set auth server process priority class."); - sLog->outString(); + sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set auth server process priority class."); + } } #endif @@ -208,17 +202,6 @@ extern int main(int argc, char **argv) uint32 numLoops = (ConfigMgr::GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000)); uint32 loopCounter = 0; - // possibly enable db logging; avoid massive startup spam by doing it here. - if (sLog->GetLogDBLater()) - { - sLog->outString("Enabling database logging..."); - sLog->SetLogDBLater(false); - // login db needs thread for logging - sLog->SetLogDB(true); - } - else - sLog->SetLogDB(false); - // Wait for termination signal while (!stopEvent) { @@ -231,7 +214,7 @@ extern int main(int argc, char **argv) if ((++loopCounter) == numLoops) { loopCounter = 0; - sLog->outDetail("Ping MySQL to keep connection alive"); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Ping MySQL to keep connection alive"); LoginDatabase.KeepAlive(); } } @@ -239,7 +222,7 @@ extern int main(int argc, char **argv) // Close the Database Pool and library StopDB(); - sLog->outString("Halting process..."); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Halting process..."); return 0; } @@ -251,31 +234,33 @@ bool StartDB() std::string dbstring = ConfigMgr::GetStringDefault("LoginDatabaseInfo", ""); if (dbstring.empty()) { - sLog->outError("Database not specified"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Database not specified"); return false; } uint8 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1); if (worker_threads < 1 || worker_threads > 32) { - sLog->outError("Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1."); + sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1."); worker_threads = 1; } uint8 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1); if (synch_threads < 1 || synch_threads > 32) { - sLog->outError("Improper value specified for LoginDatabase.SynchThreads, defaulting to 1."); + sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.SynchThreads, defaulting to 1."); synch_threads = 1; } // NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever. if (!LoginDatabase.Open(dbstring.c_str(), worker_threads, synch_threads)) { - sLog->outError("Cannot connect to database"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot connect to database"); return false; } + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Started auth database connection pool."); + sLog->EnableDBAppenders(); return true; } diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index d988b940809..453efd5bf72 100755 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -68,7 +68,7 @@ void RealmList::UpdateIfNeed() void RealmList::UpdateRealms(bool init) { - sLog->outDetail("Updating Realm List..."); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Updating Realm List..."); PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST); PreparedQueryResult result = LoginDatabase.Query(stmt); @@ -93,7 +93,7 @@ void RealmList::UpdateRealms(bool init) UpdateRealm(realmId, name, address, port, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build); if (init) - sLog->outString("Added realm \"%s\".", fields[1].GetCString()); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Added realm \"%s\".", fields[1].GetCString()); } while (result->NextRow()); } diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index 4e4965c526f..c0cf24efbfb 100755..100644 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -210,12 +210,12 @@ AuthSocket::~AuthSocket(void) {} // Accept the connection and set the s random value for SRP6 void AuthSocket::OnAccept(void) { - sLog->outBasic("'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort()); } void AuthSocket::OnClose(void) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "AuthSocket::OnClose"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "AuthSocket::OnClose"); } // Read the packet from the client @@ -234,11 +234,11 @@ void AuthSocket::OnRead() { if ((uint8)table[i].cmd == _cmd && (table[i].status == STATUS_CONNECTED || (_authed && table[i].status == STATUS_AUTHED))) { - sLog->outStaticDebug("[Auth] got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); if (!(*this.*table[i].handler)()) { - sLog->outStaticDebug("Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); return; } break; @@ -248,7 +248,7 @@ void AuthSocket::OnRead() // Report unknown packets in the error log if (i == AUTH_TOTAL_COMMANDS) { - sLog->outError("[Auth] got unknown packet from '%s'", socket().getRemoteAddress().c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "Got unknown packet from '%s'", socket().getRemoteAddress().c_str()); socket().shutdown(); return; } @@ -297,7 +297,7 @@ void AuthSocket::_SetVSFields(const std::string& rI) // Logon Challenge command handler bool AuthSocket::_HandleLogonChallenge() { - sLog->outStaticDebug("Entering _HandleLogonChallenge"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleLogonChallenge"); if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) return false; @@ -312,7 +312,7 @@ bool AuthSocket::_HandleLogonChallenge() #endif uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; - sLog->outStaticDebug("[AuthChallenge] got header, body is %#04x bytes", remaining); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] got header, body is %#04x bytes", remaining); if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining)) return false; @@ -324,8 +324,8 @@ bool AuthSocket::_HandleLogonChallenge() // Read the remaining of the packet socket().recv((char *)&buf[4], remaining); - sLog->outStaticDebug("[AuthChallenge] got full packet, %#04x bytes", ch->size); - sLog->outStaticDebug("[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] got full packet, %#04x bytes", ch->size); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I); // BigEndian code, nop in little endian case // size already converted @@ -364,7 +364,7 @@ bool AuthSocket::_HandleLogonChallenge() if (result) { pkt << (uint8)WOW_FAIL_BANNED; - sLog->outBasic("'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort()); } else { @@ -382,20 +382,20 @@ bool AuthSocket::_HandleLogonChallenge() bool locked = false; if (fields[2].GetUInt8() == 1) // if ip is locked { - sLog->outStaticDebug("[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString()); - sLog->outStaticDebug("[AuthChallenge] Player address is '%s'", ip_address.c_str()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Player address is '%s'", ip_address.c_str()); if (strcmp(fields[3].GetCString(), ip_address.c_str())) { - sLog->outStaticDebug("[AuthChallenge] Account IP differs"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP differs"); pkt << uint8(WOW_FAIL_SUSPENDED); locked = true; } else - sLog->outStaticDebug("[AuthChallenge] Account IP matches"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP matches"); } else - sLog->outStaticDebug("[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); if (!locked) { @@ -411,12 +411,12 @@ bool AuthSocket::_HandleLogonChallenge() if ((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64()) { pkt << (uint8)WOW_FAIL_BANNED; - sLog->outBasic("'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); } else { pkt << (uint8)WOW_FAIL_SUSPENDED; - sLog->outBasic("'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); } } else @@ -491,7 +491,7 @@ bool AuthSocket::_HandleLogonChallenge() for (int i = 0; i < 4; ++i) _localizationName[i] = ch->country[4-i-1]; - sLog->outBasic("'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(), + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName) ); } @@ -508,7 +508,7 @@ bool AuthSocket::_HandleLogonChallenge() // Logon Proof command handler bool AuthSocket::_HandleLogonProof() { - sLog->outStaticDebug("Entering _HandleLogonProof"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleLogonProof"); // Read the packet sAuthLogonProof_C lp; @@ -594,7 +594,7 @@ bool AuthSocket::_HandleLogonProof() // Check if SRP6 results match (password is correct), else send an error if (!memcmp(M.AsByteArray(), lp.M1, 20)) { - sLog->outBasic("'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); // Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account // No SQL injection (escaped user name) and IP address as received by socket @@ -631,7 +631,7 @@ bool AuthSocket::_HandleLogonProof() char data[4] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; socket().send(data, sizeof(data)); - sLog->outBasic("'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); uint32 MaxWrongPassCount = ConfigMgr::GetIntDefault("WrongPass.MaxCount", 0); if (MaxWrongPassCount > 0) @@ -661,7 +661,7 @@ bool AuthSocket::_HandleLogonProof() stmt->setUInt32(1, WrongPassBanTime); LoginDatabase.Execute(stmt); - sLog->outBasic("'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins); } else @@ -671,7 +671,7 @@ bool AuthSocket::_HandleLogonProof() stmt->setUInt32(1, WrongPassBanTime); LoginDatabase.Execute(stmt); - sLog->outBasic("'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", socket().getRemoteAddress().c_str(), socket().getRemotePort(), socket().getRemoteAddress().c_str(), WrongPassBanTime, _login.c_str(), failed_logins); } } @@ -685,7 +685,7 @@ bool AuthSocket::_HandleLogonProof() // Reconnect Challenge command handler bool AuthSocket::_HandleReconnectChallenge() { - sLog->outStaticDebug("Entering _HandleReconnectChallenge"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectChallenge"); if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) return false; @@ -700,7 +700,7 @@ bool AuthSocket::_HandleReconnectChallenge() #endif uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; - sLog->outStaticDebug("[ReconnectChallenge] got header, body is %#04x bytes", remaining); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got header, body is %#04x bytes", remaining); if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining)) return false; @@ -712,8 +712,8 @@ bool AuthSocket::_HandleReconnectChallenge() // Read the remaining of the packet socket().recv((char *)&buf[4], remaining); - sLog->outStaticDebug("[ReconnectChallenge] got full packet, %#04x bytes", ch->size); - sLog->outStaticDebug("[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got full packet, %#04x bytes", ch->size); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); _login = (const char*)ch->I; @@ -724,7 +724,7 @@ bool AuthSocket::_HandleReconnectChallenge() // Stop if the account is not found if (!result) { - sLog->outError("'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); socket().shutdown(); return false; } @@ -759,7 +759,7 @@ bool AuthSocket::_HandleReconnectChallenge() // Reconnect Proof command handler bool AuthSocket::_HandleReconnectProof() { - sLog->outStaticDebug("Entering _HandleReconnectProof"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectProof"); // Read the packet sAuthReconnectProof_C lp; if (!socket().recv((char *)&lp, sizeof(sAuthReconnectProof_C))) @@ -790,7 +790,7 @@ bool AuthSocket::_HandleReconnectProof() } else { - sLog->outError("'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); socket().shutdown(); return false; } @@ -799,7 +799,7 @@ bool AuthSocket::_HandleReconnectProof() // Realm List command handler bool AuthSocket::_HandleRealmList() { - sLog->outStaticDebug("Entering _HandleRealmList"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleRealmList"); if (socket().recv_len() < 5) return false; @@ -812,7 +812,7 @@ bool AuthSocket::_HandleRealmList() PreparedQueryResult result = LoginDatabase.Query(stmt); if (!result) { - sLog->outError("'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); socket().shutdown(); return false; } @@ -892,11 +892,11 @@ bool AuthSocket::_HandleRealmList() // Resume patch transfer bool AuthSocket::_HandleXferResume() { - sLog->outStaticDebug("Entering _HandleXferResume"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferResume"); // Check packet length and patch existence if (socket().recv_len() < 9 || !pPatch) { - sLog->outError("Error while resuming patch transfer (wrong packet)"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Error while resuming patch transfer (wrong packet)"); return false; } @@ -913,7 +913,7 @@ bool AuthSocket::_HandleXferResume() // Cancel patch transfer bool AuthSocket::_HandleXferCancel() { - sLog->outStaticDebug("Entering _HandleXferCancel"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferCancel"); // Close and delete the socket socket().recv_skip(1); //clear input buffer @@ -925,12 +925,12 @@ bool AuthSocket::_HandleXferCancel() // Accept patch transfer bool AuthSocket::_HandleXferAccept() { - sLog->outStaticDebug("Entering _HandleXferAccept"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferAccept"); // Check packet length and patch existence if (!pPatch) { - sLog->outError("Error while accepting patch transfer (wrong packet)"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Error while accepting patch transfer (wrong packet)"); return false; } @@ -1015,7 +1015,7 @@ void Patcher::LoadPatchMD5(char *szFileName) if (!pPatch) { - sLog->outError("Error loading patch %s\n", path.c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "Error loading patch %s\n", path.c_str()); return; } diff --git a/src/server/authserver/Server/RealmAcceptor.h b/src/server/authserver/Server/RealmAcceptor.h index 32f4f3e4122..b764e4d2494 100755 --- a/src/server/authserver/Server/RealmAcceptor.h +++ b/src/server/authserver/Server/RealmAcceptor.h @@ -48,7 +48,7 @@ protected: virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/) { - sLog->outBasic("Resuming acceptor"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Resuming acceptor"); reactor()->cancel_timer(this, 1); return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK); } @@ -58,7 +58,7 @@ protected: #if defined(ENFILE) && defined(EMFILE) if (errno == ENFILE || errno == EMFILE) { - sLog->outError("Out of file descriptors, suspending incoming connections for 10 seconds"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Out of file descriptors, suspending incoming connections for 10 seconds"); reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); reactor()->schedule_timer(this, NULL, ACE_Time_Value(10)); } diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp index e839457d1c9..c868bb43777 100755 --- a/src/server/authserver/Server/RealmSocket.cpp +++ b/src/server/authserver/Server/RealmSocket.cpp @@ -59,7 +59,7 @@ int RealmSocket::open(void * arg) if (peer().get_remote_addr(addr) == -1) { - sLog->outError("Error %s while opening realm socket!", ACE_OS::strerror(errno)); + sLog->outError(LOG_FILTER_AUTHSERVER, "Error %s while opening realm socket!", ACE_OS::strerror(errno)); return -1; } diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index e9ed4bd752d..d1c92dcf1d0 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -69,116 +69,6 @@ BindIP = "0.0.0.0" PidFile = "" # -# LogLevel -# Description: Server console level of logging -# Default: 0 - (Minimum) -# 1 - (Basic) -# 2 - (Detail) -# 3 - (Full/Debug) - -LogLevel = 0 - -# -# LogFile -# Description: Log file for main server log. -# Default: "Auth.log" - (Enabled) -# "" - (Disabled) - -LogFile = "Auth.log" - -# -# Debug Log Mask -# Description: Bitmask that determines which debug log output (level 3) -# will be logged. -# Possible flags: -# -# 64 - Anything related to network input/output, -# such as packet handlers and netcode logs -# -# Simply add the values together to create a bitmask. -# For more info see enum DebugLogFilters in Log.h -# -# Default: 0 (nothing) - -DebugLogMask = 64 - -# -# SQLDriverLogFile -# Description: Log file for SQL driver events. -# Example: "SQLDriver.log" - (Enabled) -# Default: "" - (Disabled) - -SQLDriverLogFile = "" - -# -# SQLDriverQueryLogging -# Description: Log SQL queries to the SQLDriverLogFile and console. -# Default: 0 - (Disabled, Query errors only) -# 1 - (Enabled, Full query logging - may have performance impact) - -SQLDriverQueryLogging = 0 - -# -# LogTimestamp -# Description: Append timestamp to the server log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# Default: 0 - (Disabled) -# 1 - (Enabled) - -LogTimestamp = 0 - -# -# LogFileLevel -# Description: Server file level of logging -# Default: 0 - (Minimum) -# 1 - (Basic) -# 2 - (Detail) -# 3 - (Full/Debug) - -LogFileLevel = 0 - -# -# LogColors -# Description: Colors for log messages (Format: "normal basic detail debug"). -# Colors: 0 - Black -# 1 - Red -# 2 - Green -# 3 - Brown -# 4 - Blue -# 5 - Magenta -# 6 - Cyan -# 7 - Grey -# 8 - Yellow -# 9 - Lred -# 10 - Lgreen -# 11 - Lblue -# 12 - Lmagenta -# 13 - Lcyan -# 14 - White -# Example: "13 11 9 5" - (Enabled) -# Default: "" - (Disabled) - -LogColors = "" - -# -# EnableLogDB -# Description: Write log messages to database (LogDatabaseInfo). -# Default: 0 - (Disabled) -# 1 - (Enabled) - -EnableLogDB = 0 - -# -# DBLogLevel -# Description: Log level of databases logging. -# Default: 1 - (Basic) -# 0 - (Minimum) -# 2 - (Detail) -# 3 - (Full/Debug) - -DBLogLevel = 1 - -# # UseProcessors # Description: Processors mask for Windows based multi-processor systems. # Default: 0 - (Selected by OS) @@ -255,3 +145,105 @@ LoginDatabase.WorkerThreads = 1 # ################################################################################################### + +################################################################################################### +# +# Logging system options. +# +# Appender config values: Given a appender "name" +# Appender.name +# Description: Defines 'where to log' +# Format: Type,LogLevel,Flags,optional1,optional2 +# +# Type +# 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) +# +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Flags: Default Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) +# +# Colors (read as optional1 if Type = Console) +# Format: "fatal error warn info debug trace" +# 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" +# +# File: Name of the file (read as optional1 if Type = File) +# Allows to use one "%u" to create dynamic files +# +# Mode: Mode to open the file (read as optional2 if Type = File) +# a - (Append) +# w - (Overwrite) +# + +Appender.Console=1,2,6 +Appender.Auth=2,2,7,Auth.log,w + +# Logger config values: Given a logger "name" +# Logger.name +# Description: Defines 'What to log' +# Format: Type,LogLevel,AppenderList +# Type +# 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 7 - Network input/output, +# 30 - Authserver + +Logger.Root=0,3,Console Auth + +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# AppenderList: List of appenders linked to logger +# (Using spaces as separator). +# +# Appenders +# Description: List of Appenders to read from config +# (Using spaces as separator). +# Default: "Console Server" + +Appenders=Console Auth + +# +# Loggers +# Description: List of Loggers to read from config +# (Using spaces as separator). +# Default: "root" + +Loggers=Root |
