feat(Core/Logging): improve DB logging (#5437)

This commit is contained in:
Kargatum
2021-05-17 06:49:18 +07:00
committed by GitHub
parent f239908840
commit ea2e606b13
3 changed files with 20 additions and 41 deletions

View File

@@ -81,7 +81,6 @@ enum WorldBoolConfigs
CONFIG_INSTANCE_IGNORE_RAID, CONFIG_INSTANCE_IGNORE_RAID,
CONFIG_INSTANCE_GMSUMMON_PLAYER, CONFIG_INSTANCE_GMSUMMON_PLAYER,
CONFIG_INSTANCE_SHARED_ID, CONFIG_INSTANCE_SHARED_ID,
CONFIG_GM_LOG_TRADE,
CONFIG_ALLOW_GM_GROUP, CONFIG_ALLOW_GM_GROUP,
CONFIG_ALLOW_GM_FRIEND, CONFIG_ALLOW_GM_FRIEND,
CONFIG_GM_LOWER_SECURITY, CONFIG_GM_LOWER_SECURITY,

View File

@@ -427,6 +427,9 @@ void World::LoadConfigSettings(bool reload)
sLog->LoadFromConfig(); sLog->LoadFromConfig();
} }
// Set realm id and enable db logging
sLog->SetRealmId(realmID);
#ifdef ELUNA #ifdef ELUNA
///- Initialize Lua Engine ///- Initialize Lua Engine
if (!reload) if (!reload)
@@ -926,7 +929,6 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_GM_LEVEL_IN_GM_LIST] = sConfigMgr->GetOption<int32>("GM.InGMList.Level", SEC_ADMINISTRATOR); m_int_configs[CONFIG_GM_LEVEL_IN_GM_LIST] = sConfigMgr->GetOption<int32>("GM.InGMList.Level", SEC_ADMINISTRATOR);
m_int_configs[CONFIG_GM_LEVEL_IN_WHO_LIST] = sConfigMgr->GetOption<int32>("GM.InWhoList.Level", SEC_ADMINISTRATOR); m_int_configs[CONFIG_GM_LEVEL_IN_WHO_LIST] = sConfigMgr->GetOption<int32>("GM.InWhoList.Level", SEC_ADMINISTRATOR);
m_bool_configs[CONFIG_GM_LOG_TRADE] = sConfigMgr->GetOption<bool>("GM.LogTrade", false);
m_int_configs[CONFIG_START_GM_LEVEL] = sConfigMgr->GetOption<int32>("GM.StartLevel", 1); m_int_configs[CONFIG_START_GM_LEVEL] = sConfigMgr->GetOption<int32>("GM.StartLevel", 1);
if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL]) if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL])
{ {
@@ -2075,15 +2077,6 @@ void World::SetInitialWorldSettings()
LOG_INFO("server", "WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); // outError for red color in console LOG_INFO("server", "WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); // outError for red color in console
LOG_INFO("server", " "); LOG_INFO("server", " ");
// possibly enable db logging; avoid massive startup spam by doing it here.
if (sConfigMgr->GetOption<bool>("EnableLogDB", false))
{
LOG_INFO("server", "Enabling database logging...");
if (uint32 realmId = sConfigMgr->GetOption<uint32>("RealmID", 0)) // 0 reserved for auth
sLog->SetRealmId(realmId);
}
if (sConfigMgr->isDryRun()) if (sConfigMgr->isDryRun())
{ {
LOG_INFO("server", "AzerothCore dry run completed, terminating."); LOG_INFO("server", "AzerothCore dry run completed, terminating.");

View File

@@ -9,7 +9,6 @@
# EXAMPLE CONFIG # EXAMPLE CONFIG
# CONNECTIONS AND DIRECTORIES # CONNECTIONS AND DIRECTORIES
# PERFORMANCE SETTINGS # PERFORMANCE SETTINGS
# SERVER LOGGING
# SERVER SETTINGS # SERVER SETTINGS
# CRYPTOGRAPHY # CRYPTOGRAPHY
# WARDEN SETTINGS # WARDEN SETTINGS
@@ -28,6 +27,7 @@
# CHARACTER DELETE OPTIONS # CHARACTER DELETE OPTIONS
# ITEM DELETE OPTIONS # ITEM DELETE OPTIONS
# CUSTOM SERVER OPTIONS # CUSTOM SERVER OPTIONS
# LOGGING SYSTEM SETTINGS
# PACKET SPOOF PROTECTION SETTINGS # PACKET SPOOF PROTECTION SETTINGS
# DEBUG # DEBUG
# #
@@ -67,6 +67,14 @@ RealmID = 1
DataDir = "." DataDir = "."
#
# PidFile
# Description: World daemon PID file
# Example: "./world.pid" - (Enabled)
# Default: "" - (Disabled)
PidFile = ""
# #
# LogsDir # LogsDir
# Description: Logs directory setting. # Description: Logs directory setting.
@@ -452,25 +460,6 @@ SetAllCreaturesWithWaypointMovementActive = 0
# #
################################################################################################### ###################################################################################################
###################################################################################################
# SERVER LOGGING
#
# PidFile
# Description: World daemon PID file
# Example: "./world.pid" - (Enabled)
# Default: "" - (Disabled)
PidFile = ""
#
# EnableLogDB
# Description: Write log messages to database (LogDatabaseInfo).
# Default: 0 - (Disabled)
# 1 - (Enabled)
EnableLogDB = 0
###################################################################################################
################################################################################################### ###################################################################################################
# SERVER SETTINGS # SERVER SETTINGS
# #
@@ -1836,14 +1825,6 @@ GM.InGMList.Level = 3
GM.InWhoList.Level = 3 GM.InWhoList.Level = 3
#
# GM.LogTrade
# Description: Include GM trade and trade slot enchanting operations in GM log.
# Default: 1 - (Enabled)
# 0 - (Disabled)
GM.LogTrade = 1
# #
# GM.StartLevel # GM.StartLevel
# Description: GM character starting level. # Description: GM character starting level.
@@ -3251,17 +3232,19 @@ MoveMaps.Enable = 1
Minigob.Manabonk.Enable = 1 Minigob.Manabonk.Enable = 1
# #
# Allow.IP.Based.Action.Logging # Allow.IP.Based.Action.Logging
# Description: Logs actions, e.g. account login and logout to name a few, based on IP of current session. # Description: Logs actions, e.g. account login and logout to name a few, based on IP of current session.
# Default: 0 - (Disabled) # Default: 0 - (Disabled)
# 1 - (Enabled) # 1 - (Enabled)
#
Allow.IP.Based.Action.Logging = 0 Allow.IP.Based.Action.Logging = 0
#
# Calculate.Creature.Zone.Area.Data # Calculate.Creature.Zone.Area.Data
# Description: Calculate at loading creature zoneId / areaId and save in creature table (WARNING: SLOW WORLD SERVER STARTUP) # Description: Calculate at loading creature zoneId / areaId and save in creature table (WARNING: SLOW WORLD SERVER STARTUP)
# Default: 0 - (Do not show) # Default: 0 - (Do not show)
#
Calculate.Creature.Zone.Area.Data = 0 Calculate.Creature.Zone.Area.Data = 0
@@ -3269,14 +3252,17 @@ Calculate.Creature.Zone.Area.Data = 0
# Calculate.Gameoject.Zone.Area.Data # Calculate.Gameoject.Zone.Area.Data
# Description: Calculate at loading gameobject zoneId / areaId and save in gameobject table (WARNING: SLOW WORLD SERVER STARTUP) # Description: Calculate at loading gameobject zoneId / areaId and save in gameobject table (WARNING: SLOW WORLD SERVER STARTUP)
# Default: 0 - (Do not show) # Default: 0 - (Do not show)
#
Calculate.Gameoject.Zone.Area.Data = 0 Calculate.Gameoject.Zone.Area.Data = 0
# LFG SETTINGS #
# LFG.Location.All
# #
# Includes satellite to search for work elsewhere LFG # Includes satellite to search for work elsewhere LFG
# Default: 0 - Disable # Default: 0 - Disable
# 1 - Enable # 1 - Enable
#
LFG.Location.All = 0 LFG.Location.All = 0
@@ -3432,6 +3418,7 @@ Appender.Console=1,4,0,"1 9 3 6 5 8"
Appender.Server=2,5,0,Server.log,w Appender.Server=2,5,0,Server.log,w
Appender.GM=2,5,15,gm_%s.log Appender.GM=2,5,15,gm_%s.log
Appender.DBErrors=2,5,0,DBErrors.log Appender.DBErrors=2,5,0,DBErrors.log
# Appender.DB=3,5,0
# Logger config values: Given a logger "name" # Logger config values: Given a logger "name"
# Logger.name # Logger.name