From 55ce180f2867700b28921d99f9a0cb9c83330c91 Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 3 Aug 2012 14:20:18 +0200 Subject: Core/Logging: Add Asyncronous logging with Loggers ("What to log") and Appenders ("Where to log") system. Will allow to select to full log some parts of core while others are not even logged. - Logging System is asyncronous to improve performance. - Each msg and Logger has a Log Type and Log Level assigned. Each msg is assigned the Logger of same Log Type or "root" Logger is selected if there is no Logger configured for the given Log Type - Loggers have a list of Appenders to send the msg to. The Msg in the Logger is not sent to Appenders if the msg LogLevel is lower than Logger LogLevel. - There are three (at the moment) types of Appenders: Console, File or DB (this is WIP, not working ATM). Msg is not written to the resource if msg LogLevel is lower than Appender LogLevel. - Appender and Console Log levels can be changed while server is active with command '.set loglevel (a/l) name level' Explanation of use with Sample config: Appender.Console.Type=1 (1 = Console) Appender.Console.Level=2 (2 = Debug) Appender.Server.Type=2 (2 = File) Appender.Server.Level=3 (3 = Info) Appender.Server.File=Server.log Appender.SQL.Type=2 (2 = File) Appender.SQL.Level=1 (1 = Trace) Appender.SQL.File=sql.log Appenders=Console Server (NOTE: SQL has not been included here... that will make core ignore the config for "SQL" as it's not in this list) Logger.root.Type=0 (0 = Default - if it's not created by config, server will create it with LogLevel = DISABLED) Logger.root.Level=5 (5 = Error) Logger.root.Appenders=Console Logger.SQL.Type=26 (26 = SQL) Logger.SQL.Level=3 (2 = Debug) Logger.SQL.Appenders=Console Server SQL Logger.SomeRandomName.Type=24 (24 = Guild) Logger.SomeRandomName.Level=5 (5 = Error) Loggers=root SQL SomeRandomName * At loading Appender SQL will be ignored, as it's not present on "Appenders" * sLog->outDebug(LOG_FILTER_GUILD, "Some log msg related to Guilds") - Msg is sent to Logger of Type LOG_FILTER_GUILD (24). Logger with name SomeRandomName is found but it's LogLevel = 5 and Msg LogLevel=2... Msg is not logged * sLog->outError(LOG_FILTER_GUILD, "Some error log msg related to Guilds") - Msg is sent to Logger of Type LOG_FILTER_GUILD (24). Logger with name SomeRandomeName is found with proper LogLevel but Logger does not have any Appenders assigned to that logger... Msg is not logged * sLog->outDebug(LOG_FILTER_SQL, "Some msg related to SQLs") - Msg is sent to Logger SQL (matches type), as it matches LogLevel the msg is sent to Appenders Console, Server and SQL - Appender Console has lower Log Level: Msg is logged to Console - Appender Server has higher Log Level: Msg is not logged to file - Appender SQL has lower Log Level: Msg is logged to file sql.log * sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Some msg related to Battelgrounds") - Msg is sent to Logger root (Type 0) as no Logger was found with Type LOG_FILTER_BATTLEGROUND (13). As Logger has higher LogLevel msg is not sent to any appender * sLog->outError(LOG_FILTER_BATTLEGROUND, "Some error msg related to Battelgrounds") - Msg is sent to Logger root (Type 0) as no Logger was found with Type LOG_FILTER_BATTLEGROUND (13). Msg has lower LogLevel and is sent to Appender Console - Appender Console has lower LogLevel: Msg is logged to Console --- src/server/shared/Logging/Logger.cpp | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/server/shared/Logging/Logger.cpp (limited to 'src/server/shared/Logging/Logger.cpp') diff --git a/src/server/shared/Logging/Logger.cpp b/src/server/shared/Logging/Logger.cpp new file mode 100644 index 00000000000..7464012c0ac --- /dev/null +++ b/src/server/shared/Logging/Logger.cpp @@ -0,0 +1,67 @@ +#include "Logger.h" + +Logger::Logger(): name(""), type(LOG_FILTER_GENERAL), level(LOG_LEVEL_DISABLED) +{ +} + +void Logger::Create(std::string const& _name, LogFilterType _type, LogLevel _level) +{ + name = _name; + type = _type; + level = _level; +} + +Logger::~Logger() +{ + for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) + it->second = NULL; + appenders.clear(); +} + +std::string const& Logger::getName() const +{ + return name; +} + +LogFilterType Logger::getType() const +{ + return type; +} + +LogLevel Logger::getLogLevel() const +{ + return level; +} + +void Logger::addAppender(uint8 id, Appender* appender) +{ + appenders[id] = appender; +} + +void Logger::delAppender(uint8 id) +{ + AppenderMap::iterator it = appenders.find(id); + if (it != appenders.end()) + { + it->second = NULL; + appenders.erase(it); + } +} + +void Logger::setLogLevel(LogLevel _level) +{ + level = _level; +} + +void Logger::write(LogMessage& message) +{ + if (!level || level > message.level || message.text.empty()) + { + //fprintf(stderr, "Logger::write: Logger %s, Level %u. Msg %s Level %u WRONG LEVEL MASK OR EMPTY MSG\n", getName().c_str(), messge.level, message.text.c_str(), .message.level); // DEBUG - RemoveMe + return; + } + + for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) + if (it->second) + it->second->write(message); +} -- cgit v1.2.3 From 10891028279762eb14688ec07bc22dffe3b26886 Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 3 Aug 2012 17:29:43 +0200 Subject: Add missing Copyright headers and some clarification to config files... ¬¬ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/authserver/authserver.conf.dist | 161 ++++++------ src/server/shared/Logging/Appender.cpp | 17 ++ src/server/shared/Logging/Appender.h | 17 ++ src/server/shared/Logging/AppenderConsole.cpp | 17 ++ src/server/shared/Logging/AppenderConsole.h | 17 ++ src/server/shared/Logging/AppenderDB.cpp | 17 ++ src/server/shared/Logging/AppenderDB.h | 17 ++ src/server/shared/Logging/AppenderFile.cpp | 17 ++ src/server/shared/Logging/AppenderFile.h | 17 ++ src/server/shared/Logging/LogOperation.cpp | 17 ++ src/server/shared/Logging/LogOperation.h | 17 ++ src/server/shared/Logging/LogWorker.cpp | 17 ++ src/server/shared/Logging/LogWorker.h | 17 ++ src/server/shared/Logging/Logger.cpp | 17 ++ src/server/shared/Logging/Logger.h | 17 ++ src/server/worldserver/worldserver.conf.dist | 347 +++++++++++++------------- 16 files changed, 497 insertions(+), 249 deletions(-) (limited to 'src/server/shared/Logging/Logger.cpp') diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 875d952b14c..93bbc9e3872 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -68,6 +68,89 @@ BindIP = "0.0.0.0" PidFile = "" +# +# UseProcessors +# Description: Processors mask for Windows based multi-processor systems. +# Default: 0 - (Selected by OS) +# 1+ - (Bit mask value of selected processors) + +UseProcessors = 0 + +# +# ProcessPriority +# Description: Process priority setting for Windows based systems. +# Default: 1 - (High) +# 0 - (Normal) + +ProcessPriority = 1 + +# +# RealmsStateUpdateDelay +# Description: Time (in seconds) between realm list updates. +# Default: 20 - (Enabled) +# 0 - (Disabled) + +RealmsStateUpdateDelay = 20 + +# +# WrongPass.MaxCount +# Description: Number of login attemps with wrong password before the account or IP will be +# banned. +# Default: 0 - (Disabled) +# 1+ - (Enabled) + +WrongPass.MaxCount = 0 + +# +# WrongPass.BanTime +# Description: Time (in seconds) for banning account or IP for invalid login attempts. +# Default: 600 - (10 minutes) +# 0 - (Permanent ban) + +WrongPass.BanTime = 600 + +# +# WrongPass.BanType +# Description: Ban type for invalid login attempts. +# Default: 0 - (Ban IP) +# 1 - (Ban Account) + +WrongPass.BanType = 0 + +# +################################################################################################### + +################################################################################################### +# MYSQL SETTINGS +# +# LoginDatabaseInfo +# Description: Database connection settings for the realm server. +# Example: "hostname;port;username;password;database" +# ".;somenumber;username;password;database" - (Use named pipes on Windows +# "enable-named-pipe" to [mysqld] +# section my.ini) +# ".;/path/to/unix_socket;username;password;database" - (use Unix sockets on +# Unix/Linux) +# Default: "127.0.0.1;3306;trinity;trinity;auth" + +LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" + +# +# LoginDatabase.WorkerThreads +# Description: The amount of worker threads spawned to handle asynchronous (delayed) MySQL +# statements. Each worker thread is mirrored with its own connection to the +# Default: 1 + +LoginDatabase.WorkerThreads = 1 + +# +################################################################################################### + +################################################################################################### +# +# Logging system options. +# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. +# # # Appender config values: Given a appender "name" the following options # can be read: @@ -187,81 +270,3 @@ Appender.Auth.Mode=w Logger.root.Type=0 Logger.root.Level=3 Logger.root.Appenders=Console Auth - -# -# UseProcessors -# Description: Processors mask for Windows based multi-processor systems. -# Default: 0 - (Selected by OS) -# 1+ - (Bit mask value of selected processors) - -UseProcessors = 0 - -# -# ProcessPriority -# Description: Process priority setting for Windows based systems. -# Default: 1 - (High) -# 0 - (Normal) - -ProcessPriority = 1 - -# -# RealmsStateUpdateDelay -# Description: Time (in seconds) between realm list updates. -# Default: 20 - (Enabled) -# 0 - (Disabled) - -RealmsStateUpdateDelay = 20 - -# -# WrongPass.MaxCount -# Description: Number of login attemps with wrong password before the account or IP will be -# banned. -# Default: 0 - (Disabled) -# 1+ - (Enabled) - -WrongPass.MaxCount = 0 - -# -# WrongPass.BanTime -# Description: Time (in seconds) for banning account or IP for invalid login attempts. -# Default: 600 - (10 minutes) -# 0 - (Permanent ban) - -WrongPass.BanTime = 600 - -# -# WrongPass.BanType -# Description: Ban type for invalid login attempts. -# Default: 0 - (Ban IP) -# 1 - (Ban Account) - -WrongPass.BanType = 0 - -# -################################################################################################### - -################################################################################################### -# MYSQL SETTINGS -# -# LoginDatabaseInfo -# Description: Database connection settings for the realm server. -# Example: "hostname;port;username;password;database" -# ".;somenumber;username;password;database" - (Use named pipes on Windows -# "enable-named-pipe" to [mysqld] -# section my.ini) -# ".;/path/to/unix_socket;username;password;database" - (use Unix sockets on -# Unix/Linux) -# Default: "127.0.0.1;3306;trinity;trinity;auth" - -LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" - -# -# LoginDatabase.WorkerThreads -# Description: The amount of worker threads spawned to handle asynchronous (delayed) MySQL -# statements. Each worker thread is mirrored with its own connection to the -# Default: 1 - -LoginDatabase.WorkerThreads = 1 - -# -################################################################################################### diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index 38d58f1ffb5..0b92e74c1e9 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "Appender.h" #include "Common.h" diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index c32f51e5a88..3105f0e6bb4 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef APPENDER_H #define APPENDER_H diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp index ad81a883bfa..30c7cc4d135 100644 --- a/src/server/shared/Logging/AppenderConsole.cpp +++ b/src/server/shared/Logging/AppenderConsole.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "AppenderConsole.h" #include "Config.h" #include "Util.h" diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h index a9f46cf9c4a..b81fe6dde57 100644 --- a/src/server/shared/Logging/AppenderConsole.h +++ b/src/server/shared/Logging/AppenderConsole.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef APPENDERCONSOLE_H #define APPENDERCONSOLE_H diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 6f3737adf4d..63af9176193 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "AppenderDB.h" /* FIXME diff --git a/src/server/shared/Logging/AppenderDB.h b/src/server/shared/Logging/AppenderDB.h index ca15fc1a1d5..4399195b181 100644 --- a/src/server/shared/Logging/AppenderDB.h +++ b/src/server/shared/Logging/AppenderDB.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef APPENDERDB_H #define APPENDERDB_H diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index 30c1f271c96..93c02913aeb 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "AppenderFile.h" #include "Common.h" diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index a01ea947334..bbc500f9e76 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef APPENDERFILE_H #define APPENDERFILE_H diff --git a/src/server/shared/Logging/LogOperation.cpp b/src/server/shared/Logging/LogOperation.cpp index 59368e519cd..b36dd3a8b1e 100644 --- a/src/server/shared/Logging/LogOperation.cpp +++ b/src/server/shared/Logging/LogOperation.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "LogOperation.h" #include "Logger.h" diff --git a/src/server/shared/Logging/LogOperation.h b/src/server/shared/Logging/LogOperation.h index 046ff44e62e..d872670d756 100644 --- a/src/server/shared/Logging/LogOperation.h +++ b/src/server/shared/Logging/LogOperation.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef LOGOPERATION_H #define LOGOPERATION_H diff --git a/src/server/shared/Logging/LogWorker.cpp b/src/server/shared/Logging/LogWorker.cpp index 4dc71f7f878..a12faaf224c 100644 --- a/src/server/shared/Logging/LogWorker.cpp +++ b/src/server/shared/Logging/LogWorker.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "LogWorker.h" LogWorker::LogWorker() diff --git a/src/server/shared/Logging/LogWorker.h b/src/server/shared/Logging/LogWorker.h index fe51be5376c..ea1744f9790 100644 --- a/src/server/shared/Logging/LogWorker.h +++ b/src/server/shared/Logging/LogWorker.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef LOGWORKER_H #define LOGWORKER_H diff --git a/src/server/shared/Logging/Logger.cpp b/src/server/shared/Logging/Logger.cpp index 7464012c0ac..10276eb3acb 100644 --- a/src/server/shared/Logging/Logger.cpp +++ b/src/server/shared/Logging/Logger.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "Logger.h" Logger::Logger(): name(""), type(LOG_FILTER_GENERAL), level(LOG_LEVEL_DISABLED) diff --git a/src/server/shared/Logging/Logger.h b/src/server/shared/Logging/Logger.h index 10b3991a537..9d13f08620f 100644 --- a/src/server/shared/Logging/Logger.h +++ b/src/server/shared/Logging/Logger.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef LOGGER_H #define LOGGER_H diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 01dbd5eaf2d..99cb415dc98 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -403,177 +403,6 @@ PersistentCharacterCleanFlags = 0 PidFile = "" -# -# Appender config values: Given a appender "name" the following options -# can be read: -# -# Appender.name.Type -# Description: Type of appender. Extra appender config options -# will be read depending on this value -# Default: 0 - (None) -# 1 - (Console) -# 2 - (File) -# 3 - (DB) -# -# Appender.name.Level -# Description: Appender level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Appender.name.Colors -# Description: Colors for log messages -# (Format: "fatal error warn info debug trace"). -# (Only used with Type = 1) -# Default: "" - no colors -# 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 3 1" -# -# Appender.name.File -# Description: Name of the file -# Allows to use one "%u" to create dynamic files -# (Only used with Type = 2) -# -# Appender.name.Mode -# Description: Mode to open the file -# (Only used with Type = 2) -# Default: a - (Append) -# w - (Overwrite) -# -# Appender.name.Backup -# Description: Make a backup of existing file before overwrite -# (Only used with Mode = w) -# Default: 0 - false -# 1 - true -# -# Appender.name.Timestamp -# Description: Append timestamp to the log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# (Only used with Type = 2) -# -# Logger config values: Given a logger "name" the following options -# can be read: -# -# Logger.name.Type -# Description: Type of logger. Logs anything related to... -# If no logger with type = 0 exists core will create -# it but disabled. Logger with type = 0 is the -# default one, used when there is no other specific -# logger configured for other logger types -# Default: 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 1 - Units that doesn't fit in other categories -# 2 - Pets -# 3 - Vehicles -# 4 - C++ AI, instance scripts, etc. -# 5 - DB AI, such as SAI, EAI, CreatureAI -# 6 - DB map scripts -# 7 - Network input/output, -# such as packet handlers and netcode logs -# 8 - Spellsystem and aurasystem -# 9 - Achievement system -# 10 - Condition system -# 11 - Pool system -# 12 - Auction house -# 13 - Arena's and battlegrounds -# 14 - Outdoor PVP -# 15 - Chat system -# 16 - LFG system -# 17 - Maps, instances (not scripts), -# grids, cells, visibility, etc. -# 18 - Player that doesn't fit in other categories. -# 19 - Player loading from DB -# (Player::_LoadXXX functions) -# 20 - Items -# 21 - Player skills (do not confuse with spells) -# 22 - Player chat logs -# 23 - loot -# 24 - guilds -# 25 - transports -# 26 - SQL. DB errors and SQL Driver -# 27 - GM Commands -# 28 - Remote Access Commands -# 29 - Warden -# 30 - Authserver -# 31 - Worldserver -# 32 - Game Events -# 33 - Calendar -# -# Logger.name.Level -# Description: Logger level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Logger.name.Appenders -# Description: 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" -# -# Loggers -# Description: List of Loggers to read from config -# (Using spaces as separator). -# Default: "root" - -Loggers=root GM SQL -Appenders=Console Server GM SQL - -Appender.Console.Type=1 -Appender.Console.Level=2 - -Appender.Server.Type=2 -Appender.Server.Level=2 -Appender.Server.File=Server.log -Appender.Server.Mode=w - -Appender.GM.Type=2 -Appender.GM.Level=2 -Appender.GM.File=gm_#%u.log - -Appender.SQL.Type=2 -Appender.SQL.Level=2 -Appender.SQL.File=SQL.log - -Logger.root.Type=0 -Logger.root.Level=3 -Logger.root.Appenders=Console Server - -Logger.SQL.Type=26 -Logger.SQL.Level=3 -Logger.SQL.Appenders=Console Server SQL - -Logger.GM.Type=27 -Logger.GM.Level=3 -Logger.GM.Appenders=Console Server GM - # # ChatLogs.Channel # Description: Log custom channel chat. @@ -648,6 +477,7 @@ ChatLogs.Addon = 0 ChatLogs.BattleGround = 0 +# Extended Logging system configuration moved to end of file (on purpose) # ################################################################################################### @@ -2746,3 +2576,178 @@ PlayerDump.DisallowOverwrite = 1 # ################################################################################################### + +################################################################################################### +# +# Logging system options. +# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. +# +# +# Appender config values: Given a appender "name" the following options +# can be read: +# +# Appender.name.Type +# Description: Type of appender. Extra appender config options +# will be read depending on this value +# Default: 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) +# +# Appender.name.Level +# Description: Appender level of logging +# Default: 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Appender.name.Colors +# Description: Colors for log messages +# (Format: "fatal error warn info debug trace"). +# (Only used with Type = 1) +# Default: "" - no colors +# 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 3 1" +# +# Appender.name.File +# Description: Name of the file +# Allows to use one "%u" to create dynamic files +# (Only used with Type = 2) +# +# Appender.name.Mode +# Description: Mode to open the file +# (Only used with Type = 2) +# Default: a - (Append) +# w - (Overwrite) +# +# Appender.name.Backup +# Description: Make a backup of existing file before overwrite +# (Only used with Mode = w) +# Default: 0 - false +# 1 - true +# +# Appender.name.Timestamp +# Description: Append timestamp to the log file name. +# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext +# (Only used with Type = 2) +# +# Logger config values: Given a logger "name" the following options +# can be read: +# +# Logger.name.Type +# Description: Type of logger. Logs anything related to... +# If no logger with type = 0 exists core will create +# it but disabled. Logger with type = 0 is the +# default one, used when there is no other specific +# logger configured for other logger types +# Default: 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 1 - Units that doesn't fit in other categories +# 2 - Pets +# 3 - Vehicles +# 4 - C++ AI, instance scripts, etc. +# 5 - DB AI, such as SAI, EAI, CreatureAI +# 6 - DB map scripts +# 7 - Network input/output, +# such as packet handlers and netcode logs +# 8 - Spellsystem and aurasystem +# 9 - Achievement system +# 10 - Condition system +# 11 - Pool system +# 12 - Auction house +# 13 - Arena's and battlegrounds +# 14 - Outdoor PVP +# 15 - Chat system +# 16 - LFG system +# 17 - Maps, instances (not scripts), +# grids, cells, visibility, etc. +# 18 - Player that doesn't fit in other categories. +# 19 - Player loading from DB +# (Player::_LoadXXX functions) +# 20 - Items +# 21 - Player skills (do not confuse with spells) +# 22 - Player chat logs +# 23 - loot +# 24 - guilds +# 25 - transports +# 26 - SQL. DB errors and SQL Driver +# 27 - GM Commands +# 28 - Remote Access Commands +# 29 - Warden +# 30 - Authserver +# 31 - Worldserver +# 32 - Game Events +# 33 - Calendar +# +# Logger.name.Level +# Description: Logger level of logging +# Default: 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Logger.name.Appenders +# Description: 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" +# +# Loggers +# Description: List of Loggers to read from config +# (Using spaces as separator). +# Default: "root" + +Loggers=root GM SQL +Appenders=Console Server GM SQL + +Appender.Console.Type=1 +Appender.Console.Level=2 + +Appender.Server.Type=2 +Appender.Server.Level=2 +Appender.Server.File=Server.log +Appender.Server.Mode=w + +Appender.GM.Type=2 +Appender.GM.Level=2 +Appender.GM.File=gm_#%u.log + +Appender.SQL.Type=2 +Appender.SQL.Level=2 +Appender.SQL.File=SQL.log + +Logger.root.Type=0 +Logger.root.Level=3 +Logger.root.Appenders=Console Server + +Logger.SQL.Type=26 +Logger.SQL.Level=3 +Logger.SQL.Appenders=Console Server SQL + +Logger.GM.Type=27 +Logger.GM.Level=3 +Logger.GM.Appenders=Console Server GM -- cgit v1.2.3