This is just a thread where I'd like feedback before writing the patch for MaNGOS.
I wrote a database logging patch for my own core, as well as Trinity, and would now like to also provide it for MaNGOS. In [7873], Vladimir did a change for me that was necessary to do this. So, kudos to him .
Now, there is one downside of database logging: Colors will have to be.. 'altered'. I had issues with colors being saved to the database (which is obviously totally wrong!), and thus, I removed colors completely. I don't currently know a way to do this with colors enabled. Of course it'd work, but logs would be ugly when selecting them from the database. So, I may choose to remove colors. This is one of the main things I want feedback on.
Now, that's pretty much the only 'real' problem I've had during development of this.
Database logging should generally make a server much faster, because dispatching a query to MySQL usually is faster than writing to a file (after all, MySQL handles the file writing, and thus won't slow down MaNGOS). This is assuming the MySQL server is on a decent machine, with decent settings, of course.
Now, just so you have something to drool over:
mysql> select count(*) from realmd.logs;
+----------+
| count(*) |
+----------+
| 31201271 |
+----------+
1 row in set (0.00 sec)
Yep, 31 million rows. This is with LogLevel 3 (debug build), on a server with 30~ players, latency is around 40ms. With file logging completely disabled, of course.
How the logs table structure will look:
CREATE TABLE `logs` (
`time` int(14) NOT NULL, -- time of this log call
`realm` int(4) NOT NULL, -- 0 if realmd
`type` int(4) NOT NULL, -- will be defined in Log.h
`string` text -- actual string
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
So, any feedback on all this is appreciated.