Commit Graph

324 Commits

Author SHA1 Message Date
Spp
4a5a077b65 Core/Logging: Use prepared statements in AppenderDB 2012-08-06 13:36:34 +02:00
Spp
156d1e7b3c Core/SQL: Kill core if error 1064 is triggered (error code 1064 you have an error in your sql syntax). This means the sql has an build error and core fix is needed 2012-08-06 13:23:09 +02:00
Spp
97c4b92eb0 Core/Logging: Try to simplify configuration of loggers and appenders
Changed multiple lines to a simple format:
- Logger.name=Type,LogLevel,Flags,AppenderList
- Appender.name=Type,LogLevel,Flags,optional1,optional2
  * Type = File: optional1 = File name, optiona2 = Mode
  * Type = Console: optional1 = Colors

Created a default set of loggers and appenders.
- Root logger defaults to Error, that means you will see nothing on console by default (not even loading)
- You need to add the loggers to Loggers options if you want to enable them, otherwise Root logger will be used for all types

Restored outSQLDriver (LOG_FILTER_SQL_DRIVER), outSQLDev (LOG_FILTER_SQL_DEV), outArena (LOG_FILTER_ARENA) and outChar (LOG_FILTER_CHARACTER) functionality by creating new types (LOG_FILTER_CHARACTER is a rename of LOG_FILTER_DELETE.

Note: You need to update your config file... again (yeah sorry... trying to make it simpler)
2012-08-06 12:10:33 +02:00
Vincent-Michael
cc0ff69ca4 Core/Commands:
* Add remove support for disable command
* Add quest disables support
* Add check for no existent entry
* Fix problems with flags 0
* Fix code style
2012-08-05 02:02:35 +02:00
Spp
634776e0bc Fix compile under windows 2012-08-03 15:54:54 +02:00
Spp
55ce180f28 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
2012-08-03 14:20:18 +02:00
Alternative
dc7030ced6 Some codestyle changes. 2012-08-02 16:47:28 -04:00
Alternative
f303782de4 Added disable commands. 2012-08-02 16:33:35 -04:00
Shauren
4df39dae95 Core/AuctionHouse: Refactored and corrected building auction mail messages 2012-07-19 15:33:14 +02:00
NNN666
e757ebf6ba Core/Player: Fix issues with 'ignore this slot' option on equipment manager usage 2012-07-13 16:27:11 +02:00
Shauren
c8d20004a5 Core: Minor code style corrections 2012-06-30 16:07:09 +02:00
Shauren
c7775c8d72 Core/Maps: Moved object respawn time storage from global to map level. This removes unneccessary locking since all objects run within its map's thread. 2012-06-07 23:20:57 +02:00
kaelima
f34e650fe0 Core/Accounts: Delete all bans related to an account when it has been deleted. 2012-05-06 02:37:31 +02:00
kaelima
7f51c399c6 Core/DBLayer: CHAR_DEL_CHAR_AURA_FROZEN query should be asynchronous
Closes issue #6273

Also corrected one opcode name in Opcodes.cpp (changes nothing)
2012-04-30 02:07:59 +02:00
Shauren
c055a8617d Scripts/Icecrown Citadel
* Fixed Professor Putricide Tear Gas stunning himself
* Fixed visual of Unstable Experiment
* Fixed oozes not picking new targets after hitting old
* Fixed Gas Cloud not using melee attack
* Removed ooze summon position hack

Closes #4301
Closes #2726
Closes #5119
Closes #4464
Closes #2874
Closes #4407
Closes #2421
Closes #4899
2012-04-13 19:56:00 +02:00
faramir118
f9ae8e6810 Core/DBLayer: incorrect use of va_start
Signed-off-by: Machiavelli <machiavelli.trinity@gmail.com>
2012-04-11 19:51:26 +02:00
kaelima
7f903edcd9 Core/DBLayer: Fix two crashes when using pdump command
Closes #6107
2012-04-09 03:33:46 +02:00
Nay
3d83f663f6 Core/Tickets: Add report time and current latency to lag_reports table
It's a tiny bit more useful now.
2012-04-07 19:12:14 +01:00
Shauren
d9451cedd8 Core/World: Add character name data after loading PlayerDump
Closes #3653

Note: Manual changes in database while the server is running are not advised thus not supported
2012-04-03 00:02:58 +02:00
kaelima
ede839dd97 Core/Database: Some extended debug output for Field::GetXXX logs. 2012-04-02 03:30:19 +02:00
Nay
b7f7e3118c Core/DBLayer: More type fixes
Thanks to Vasago for the help in spotting the errors
Thanks to Subv as well (so he doesn't feel lonely)
2012-04-01 22:41:47 +01:00
Nay
91c7b5d2ca Core/DBLayer: Delete a triplicated prepared statement (LoginDatabase)
Thanks to Anubiss for spotting it
2012-03-31 15:48:40 +01:00
Nay
c71f75e9ca Core/Logging: Fix a typo in DebugLogFilters - Database & AI
Thanks to Garthog for finding it
2012-03-31 15:13:56 +01:00
Shauren
68fdf2a12f Core/DBLayer: Added missing prepared statement implementation for uint8/16 2012-03-31 14:16:48 +02:00
Shauren
5843851559 Core/DBLayer: More prepared statement corrections 2012-03-29 23:22:10 +02:00
click
6237ddac34 Partially revert a36a0a77ef.
Cleaning databases for old/deprecated and expired quests should never be a
developers choice specifically. This should be done by admins, not developers,
through the use of the already existing paramters found in the worldserver config :
CleanCharacterDB / PersistentCharacterCleanFlags

An adjustment to the respective questloader prepared statement has been done to
accomodate for the earlier change (by not loading such quests into memory at all).

Documentation for how this cleanup-procedures work already exists in the core :
doc/CharacterDBCleanup.txt.
2012-03-28 19:31:06 +02:00
Machiavelli
1ee7196ec0 Core/DB Layer: Fix helgrind errors on some concurrent access to resultset auto pointers.
Example:
==8753== Possible data race during read of size 8 at 0x2e803e60 by thread #8
==8753==    at 0xDD0FFC: PreparedResultSet::operator[](unsigned int) const (QueryResult.h:83)
==8753==    by 0x131D82D: WorldSession::HandleCharEnum(Trinity::AutoPtr<PreparedResultSet, ACE_Null_Mutex>) (CharacterHandler.cpp:217)
==8753==    by 0x118F8C3: WorldSession::ProcessQueryCallbacks() (WorldSession.cpp:1087)
{..}
==8753==  Address 0x2e803e60 is 0 bytes inside a block of size 16 alloc'd
==8753==    at 0x4C28B75: operator new(unsigned long) (vg_replace_malloc.c:261)
==8753==    by 0x137D515: __gnu_cxx::new_allocator<Field*>::allocate(unsigned long, void const*) (new_allocator.h:92)
==8753==    by 0x137D378: std::_Vector_base<Field*, std::allocator<Field*> >::_M_allocate(unsigned long) (in /home/aokromes/bin/bin/worldserver)
==8753==    by 0x137CEC6: std::vector<Field*, std::allocator<Field*> >::_M_fill_insert(__gnu_cxx::__normal_iterator<Field**, std::vector<Field*, std::allocator<Field*> > >, unsigned long, Field* const&) (vector.tcc:416)
==8753==    by 0x137CB27: std::vector<Field*, std::allocator<Field*> >::insert(__gnu_cxx::__normal_iterator<Field**, std::vector<Field*, std::allocator<Field*> > >, unsigned long, Field* const&) (stl_vector.h:944)
==8753==    by 0x137C964: std::vector<Field*, std::allocator<Field*> >::resize(unsigned long, Field*) (stl_vector.h:632)
==8753==    by 0x137BFCA: PreparedResultSet::PreparedResultSet(st_mysql_stmt*, st_mysql_res*, unsigned long, unsigned int) (QueryResult.cpp:98)
==8753==    by 0x137A12B: MySQLConnection::Query(PreparedStatement*) (MySQLConnection.cpp:493)
==8753==    by 0x137F663: PreparedStatementTask::Execute() (PreparedStatement.cpp:412)

Have a feeling this is a false positive, though. Nevertheless good to get rid of.
2012-03-27 13:33:02 +03:00
Machiavelli
88d81d27cf Core/DB Layer: - Fix "Thread #1 unlocked a not-locked lock at 0x6D56E90" helgrind error (thanks to Aokromes for logs). Cause was unlocking MySQL connection on shutdown, but concurrent access at this point is not required.
- Remove redundant locking in PingOperation. Since these are delayed to async threads with their own MySQL connection, no concurrent access here either.
- Codestyle cleanup
- Documentation refining
2012-03-27 11:50:03 +02:00
leak
830a7fb08b Core/DBLayer: Restore pet loading
closes #5878
2012-03-26 18:58:24 +02:00
leak
b1ca1ee5ec Core/DBLayer: Convert PAppend() queries to prepared statements No.4 NOTE:
Most of the cores queries have been converted to prepared statements now. If your code contains queries, please either use the exiting or implement new statements.
The only exclusions are one-time queries (e.g. for core startup) and queries that can't be prepared due to limitations.
2012-03-26 15:47:37 +02:00
Machiavelli
e960016dc4 Partial revert of "Core/DB Layer: Fix a memory leak.", mysql library related stuff. Original memory leak fix is still in place. 2012-03-26 13:33:47 +02:00
Machiavelli
70ee37f3b4 Core/DB Layer: Fix a memory leak for synchronously executed prepared statements. 2012-03-26 08:58:21 +02:00
Machiavelli
43048afc7e Core/DB Layer: Fix a memory leak. 2012-03-26 08:29:41 +02:00
kaelima
19f821d00a Auth/Realmlist: Make use of RealmFlags and rename color to flag (core- and dbwise)
Also fix connecting with realmflag & 4
2012-03-26 05:14:10 +02:00
Machiavelli
3f61bd0a26 Core/DB Layer: Make SQLTransaction AutoPtr thread safe (valgrind caught a race condition) 2012-03-26 02:56:43 +03:00
Machiavelli
fa1d3f305b Core/Misc: Implement Trinity::Auto_Ptr. Ditches ACE_Refcounted_AutoPtr (we strongly suspect it does NOT clean up the underlying pointer properly). Underlying type is now ACE_Strong_Bound_Ptr 2012-03-25 21:21:23 +02:00
leak
eb1af30399 Core/DBLayer: Convert PAppend() queries to prepared statements No.3 2012-03-25 20:20:25 +02:00
leak
71c02fb54d Core/DBLayer: Convert PAppend() queries to prepared statements No.2 2012-03-25 18:32:26 +02:00
leak
4e6fce1112 Core/DBLayer: Typo on query conversion 2012-03-25 16:34:09 +02:00
leak
c6cbe4c77c Core/DBLayer: Convert PAppend() queries to prepared statements No.1 2012-03-25 16:25:06 +02:00
Machiavelli
eda06321b9 Update src/server/shared/Database/Field.h 2012-03-25 14:11:24 +03:00
Machiavelli
87176c84d3 Core/DBLayer: Refine field type checks in Field::GetXXX methods. Should give us logs of wrong GetXXX calls for a certain type without having to dig trough valgrind logs. 2012-03-25 14:10:06 +03:00
leak
61691d7698 Core/DBLayer: Restore pinfo timestamp output (Prepared statment results don't deliver TIMESTAMP as string) 2012-03-25 00:00:16 +01:00
click
cbcd4e6afb Core: Fix .pinfo handling of player level and securitylevel after recent cleanups (and clean up my last commit) 2012-03-24 22:59:23 +01:00
click
eb3305932c Core/DB layer: Change functionality in previous memoryleak-fix (Patch by raczman) 2012-03-24 22:34:33 +01:00
Machiavelli
0eb3ffca41 Core/DB Layer: Fix a memory leak. Author: raczman (yes, you read correctly) 2012-03-24 19:24:36 +01:00
leak
47a597d406 Core/DBLayer: Query should actually be available on both sync and async mysql connections 2012-03-24 17:32:00 +01:00
leak
cddf1dcf03 Core/DBLayer: Prepare statement on the right connection
fixes #5862
2012-03-24 14:54:24 +01:00
leak
12e55a04bb Core/DBLayer: Convert PQuery() queries to prepared statements 2012-03-24 01:25:08 +01:00
leak
4665d5bfc4 Core/DBLayer: Remnant cleanups 2012-03-19 18:09:14 +01:00