Trinitycore analysis on the World of Warcraft Server 3: Log Module,

Source: Internet
Author: User

Trinitycore analysis on the World of Warcraft Server 3: Log Module,
I. Log Interface

There are six levels of TrinityCore logs: Trace, Debug, Info, Warn, Error, and Fatal.

They correspond to the following six interfaces respectively (filterType _ is also specified in the configuration file)

#define TC_LOG_TRACE(filterType__, ...)#define TC_LOG_DEBUG(filterType__, ...)#define TC_LOG_INFO(filterType__, ...)#define TC_LOG_WARN(filterType__, ...)#define TC_LOG_ERROR(filterType__, ...)#define TC_LOG_FATAL(filterType__, ...)

Ii. Log Type and Appender

Note: This is detailed in the remarks in the configuration file. Please post two paragraphs directly.

Appender Configuration:

#  Appender config values: Given a appender "name"#    Appender.name#        Description: Defines 'where to log'#        Format:      Type,LogLevel,Flags,optional1,optional2,optional3##                     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:#                         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##                     File: Name of the file (read as optional1 if Type = File)#                         Allows to use one "%s" to create dynamic files##                     Mode: Mode to open the file (read as optional2 if Type = File)#                          a - (Append)#                          w - (Overwrite)##                     MaxFileSize: Maximum file size of the log file before creating a new log file

Log Configuration:

#  Appender config values: Given a appender "name"#    Appender.name#        Description: Defines 'where to log'#        Format:      Type,LogLevel,Flags,optional1,optional2,optional3##                     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:#                         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##                     File: Name of the file (read as optional1 if Type = File)#                         Allows to use one "%s" to create dynamic files##                     Mode: Mode to open the file (read as optional2 if Type = File)#                          a - (Append)#                          w - (Overwrite)##                     MaxFileSize: Maximum file size of the log file before creating a new log file

3. Configuration example:
Appender.Console=1,3,0Appender.Server=2,2,0,Server.log,wLogger.root=2,Console Server

The above three sentences define two Appender: Console, Server, one log type: root

Appender. Console indicates to output logs to the terminal. The minimum output level is Info, and the output font color is black (different terminals)

Appender. Server indicates that logs are output to files. The lowest output level is Debug, and the output file is (Server. log). logs are written by rewriting (not adding ).

The lowest output level of Logger. root is Info. Use the Console and Server configurations.


4. Underlying implementation

Here, I will not go into depth.

Take TC_LOG_INFO ("qch", "Hello, world"); as an example.

This statement is called.

if(Log::instance()::ShouldLog("qch", LOG_LEVEL_INFO) )        Log::instance()::outMessage ("qch", LOG_LEVEL_INFO, "Hello,world");

ShouldLog is easy to understand. Simply compare the lowest log output level in the configuration file with LOG_LEVEL_INFO.

OutMessage is quite troublesome. If you are interested in calling outMessage, you can check it out. I will not explain it here.

 

If you set the Appender Type to 3 (DB), insert a record in the logs table of the auth database for each log:

INSERT INTO logs (time, realm, type, level, string) VALUES (1409544332, 0, 'qch', 3,'Hello, world\n')


Change to the TrinityCoreconf file in the big mango World of Warcraft TCCN-313-Trinity4666

To sum up, please try to modify the following parameter # SERVER setting MinLevelForHeroicCharacterCreating = 1 MaxPlayerLevel = 70 StartPlayerLevel = 1 StartHeroicPlayerLevel = 1 # SERVER RATESRate. XP. kill = 0. If it does not work after the attempt, it is probably because of database problems. This is not enough to be checked ......
 
Teach: Big mango World of Warcraft TCCN-335-Trinity8400 server TrinityCoreconf settings

Which has a higher priority,
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.