Updated Logging Packets (markdown)

Chris Miles
2018-07-01 03:01:15 -05:00
parent 86c6076fcb
commit a8a3ff48ba
+43 -63
@@ -1,79 +1,59 @@
# Logging System
### Packet Logging
### Preface
* Useful for developers, it can be very handy to see what activitiy is happening realtime. We now have the ability to sink it to any output format simultaneously.
* EQEmu used to have many different logging systems in its past. They all were configured differently, all had different configuration formats. In 2015 - a much needed massive overhaul to our logging was made and it has been one of the most valuable things to our project to date.
### Features
* Log levels
* Hot-Reload of log settings
* In game, real time server logs
* Debug levels
* Categories (Spells, Merchants, Loot etc.)
### Output formats
* Console
* File
* In game (gmsay)
* Can easily be extended to be implemented with other output sinks
### Debug Levels
**Level**||**Description**
-----|-----|-----
General|1|Low-Level general debugging, useful info on single line|
Moderate|2|Informational based - used in functions|
Detail|3|Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication|
* Debug levels are PER category, so if you wanted to set for example, level 3 debugging enabled to gmsay (In Game) but only 1 to your console, you put respectively 1 in your console field and 3 in gmsay for whatever category it is your enable
### Settings
* All settings are managed in **logsys_categories** database table
* When a process boots up, such as **zone/world/ucs/queryserv/etc**. \- These settings will load and whatever applies to the server category wise is what it will use as **'rules'** to understand where to send output, as well as what level of information (high or low) to display
* Please note that **log\_to\_gmsay** is only available for **Zone level debugging.**
## In-Game Commands
**Command**|**Description**|
-----|-----
#logs | Displays usage menu
#logs reload_all | Reload all settings in world and all zone processes with what is defined in the database
#logs list_settings | Shows current log settings and categories loaded into the current process' memory
#logs set \[console\|file\|gmsay\] | Sets log settings during the lifetime of the zone
### Packet Categories
```
#logs set [gmsay|file|console] [category_id] [log_level]
select * from logsys_categories where log_category_description like '%packet%';
+-----------------+------------------------------------+----------------+-------------+--------------+
| log_category_id | log_category_description | log_to_console | log_to_file | log_to_gmsay |
+-----------------+------------------------------------+----------------+-------------+--------------+
| 5 | Packet: Client -> Server | 0 | 0 | 0 |
| 39 | Packet: Server -> Client | 0 | 0 | 0 |
| 40 | Packet: Client -> Server Unhandled | 0 | 0 | 0 |
| 41 | Packet: Server -> Client With Dump | 0 | 0 | 0 |
| 42 | Packet: Server -> Client With Dump | 0 | 0 | 0 |
+-----------------+------------------------------------+----------------+-------------+--------------+
5 rows in set (0.04 sec)
```
## File Logs
#### Enable in Game (Example)
* All **zone logs** go underneath a respective **logs/zone/**
* All zones, once booted up, will have a name that actually means something to a server administrator:
* nexus\_version\_0\_inst\_id\_0\_port\_7000\_20084.log
* nexus\_version\_0\_inst\_id\_0\_port\_7000\_24356.log
* zone_20084.log \- A zone that has been booted up as a dynamic, but not assigned to any logical zone yet
* Crash Logs will make their way underneath `logs/crash`
* All other process logs go to the top level of logs, this may change
* Naming Convention:
* Unless a zone is using zone properties for the file name, most processes will look like the following convention
* process\_name\_process_id.log
Below would enable client -> server direction packet logging to the client
## Example Output Screenshots
```
#logs set gmsay 5 1
```
### GM-Say
## Server to Client
![](https://i.imgur.com/FaWAgAq.gif)
All server packets that are sent to the client, the only packet types that aren't sent to the client while in game are the message packets themselves because that would cause a loop
### Windows Console of Zone
![image](https://i.imgur.com/llm7EXY.gif)
![](https://i.imgur.com/okWg2y8.png)
## Client to Server
## Linux Console
Packets being sent from client to server
ANSI Color support
![image](https://i.imgur.com/8t4tkrB.gif)
![](https://i.imgur.com/SC9lO4N.png)
## Unhandled Packets
In this example - a client clicking a 'Krono' is unhandled by the server, at which it dumps a packet of data sent from the client
![image](https://i.imgur.com/XkPDXb9.gif)
### Packet Logging Levels
* The main differentiator when deciding how much information you want to see with each packet, you use two different but very smiliar categories for each type. It all comes down to whether or not you want to see the packet dump data with the packet or not. As of this time, Packet: Client -> Server Unhandled always dumps the packet because they are far less frequent.
* Packet: Client -> Server
* Packet: Server -> Client
* Packet: Server -> Client With Dump
* Packet: Server -> Client With Dump
## Packet Information (With Dump)
Below is an example of a full packet payload being output to the client
![](https://i.imgur.com/C9SnDRD.gif)