Commit Graph

106 Commits

Author SHA1 Message Date
jackpoz
0904858624 Revert "Core/Logging: store loggers in cache correctly"
This reverts commit c6a4d5a1de.
2014-05-18 16:04:59 +02:00
Dehravor
cbd36d5a4e Core/Misc: Remove remaining COMPILER_HAS_CPP11_SUPPORT related macros 2014-05-01 11:19:32 +02:00
joschiwald
c6a4d5a1de Core/Logging: store loggers in cache correctly 2014-04-08 21:27:02 +02:00
Shauren
aeff7944d1 Core/Logging: Fixed filenames of backup logs
Closes #11765
2014-03-24 09:01:44 +01:00
Shauren
e469ff5e88 Fixed build without PCH 2014-03-23 12:54:09 +01:00
jackpoz
592b57a251 Shared/Logs: Code cleanup
Remove unneeded check added in 89af6097f3
2014-02-08 11:35:25 +01:00
jackpoz
89af6097f3 Shared/Logs: Make AppenderFile more thread-safe
In case of dynamic file names don't store the FILE* handle in a shared class variable but keep it only at function scope.

Valgrind log:
  at _IO_un_link (genops.c:69)
  by fclose@@GLIBC_2.2.5 (iofclose.c:55)
  by AppenderFile::CloseFile() (AppenderFile.cpp:94)
  by AppenderFile::_write(LogMessage const&) (AppenderFile.cpp:66)
  by Appender::write(LogMessage&) (Appender.cpp:102)
  by Logger::write(LogMessage&) const (Logger.cpp:63)
  by Log::write(LogMessage*) (Log.cpp:279)
  by Log::vlog(std::string const&, LogLevel, char const*, __va_list_tag*) (Log.cpp:267)
  by Log::outMessage(std::string const&, LogLevel, char const*, ...) (Log.h:129)
Address 0x2a1bd2d0 is 0 bytes inside a block of size 568 free'd
  at free (vg_replace_malloc.c:468)
  by fclose@@GLIBC_2.2.5 (iofclose.c:85)
  by AppenderFile::CloseFile() (AppenderFile.cpp:94)
  by AppenderFile::_write(LogMessage const&) (AppenderFile.cpp:66)
  by Appender::write(LogMessage&) (Appender.cpp:102)
  by Logger::write(LogMessage&) const (Logger.cpp:63)
  by Log::write(LogMessage*) (Log.cpp:279)
  by Log::vlog(std::string const&, LogLevel, char const*, __va_list_tag*) (Log.cpp:267)
  by Log::outMessage(std::string const&, LogLevel, char const*, ...) (Log.h:129)
2014-02-07 23:35:03 +01:00
jackpoz
672e06a951 Shared/Logs: Add workaround for "w" flag used with dynamic name files
Ignore "w" flag and always use "a" for log files with dynamic name since the file handle is created at every log line and "w" would delete any other logged line from previous _write() calls.
The best solution would be to overwrite only at first call and append at any other call.
2014-02-07 22:23:24 +01:00
Vincent_Michael
20004050bc Update copyright note for 2014.
Happy new year.
2014-01-01 00:07:53 +01:00
Spp
39331ea7b9 Core/Logging: Use logger cache for speed up logger filter search 2013-12-19 10:34:55 +01:00
Spp
cd48662233 Core/Logging: Minor changes
- Select stderr when writing ERROR and FATAL messages
- Simplify function defines
- Fix `logs` table structure with latest logging changes
2013-11-11 14:35:16 +01:00
Spp
94e2b9332a Core/Logging: Remove LOG_FILTER_XXX defines with it's value (remember logger names are case-sensitive) 2013-11-08 10:50:51 +01:00
Spp
1b04bec290 Core/Logs: Create default set of loggers and Appender if the config is wrong.
- Logger root (Error)
- Logger server (Info)
- Appender Console

Logger names are case-sensitive, Appender names are not.
2013-11-08 08:55:10 +01:00
Spp
8aa9745c4c Core/Logging: Extend logging system to allow inheritance of loggers
- Changed default loggers and appenders
- '.' determines the relation between loggers ("type.subtype" inherits "type" logger setting if logger "type.subtype" is not defined)
- When core logs a message it search for the correct logger (root is the default one)
  ie: a message logged with "type.subtype"
  * Core will try to find a logger with name "type.subtype", if its not found then will search for "type", again if its not found it will return the default one "root"
2013-11-07 16:34:44 +01:00
leguybrush
0a308144a8 Core/Code: Unify [more] codestyle for brackets: )\n{\n} to ) { }. 2013-10-28 14:36:07 -04:00
jackpoz
1b3575ba77 Core/Logs: Fix race condition in Log
Fix race condition in Log by using atomic operators.

Helgrind log:
 Possible data race during read of size 8 at 0x7379D98 by thread #1
 Locks held: none
  at 0x15AE9C7: AppenderFile::_write(LogMessage const&) (AppenderFile.cpp:59)
  by 0x15ADFF8: Appender::write(LogMessage&) (Appender.cpp:106)
  by 0x159F14E: Logger::write(LogMessage&) (Logger.cpp:83)
  by 0x15A215B: Log::write(LogMessage*) (Log.cpp:290)
  by 0x15A200F: Log::vlog(LogFilterType, LogLevel, char const*, __va_list_tag*) (Log.cpp:272)
  by 0x15A2682: Log::outInfo(LogFilterType, char const*, ...) (Log.cpp:364)
  by 0xF7DA28: Master::Run() (Master.cpp:296)
  by 0xF835E8: main (Main.cpp:142)

 This conflicts with a previous write of size 8 by thread #10
 Locks held: none
  at 0x15AE9D7: AppenderFile::_write(LogMessage const&) (AppenderFile.cpp:59)
  by 0x15ADFF8: Appender::write(LogMessage&) (Appender.cpp:106)
  by 0x159F14E: Logger::write(LogMessage&) (Logger.cpp:83)
  by 0x15A215B: Log::write(LogMessage*) (Log.cpp:290)
  by 0x15A200F: Log::vlog(LogFilterType, LogLevel, char const*, __va_list_tag*) (Log.cpp:272)
  by 0x15A2682: Log::outInfo(LogFilterType, char const*, ...) (Log.cpp:364)
  by 0xF7EC1F: FreezeDetectorRunnable::run() (Master.cpp:98)
  by 0x15A5B3E: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)

 Address 0x7379D98 is 88 bytes inside a block of size 96 alloc'd
  at 0x4C2C857: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
  by 0x15A0FE3: Log::CreateAppenderFromConfig(char const*) (Log.cpp:150)
  by 0x15A1AED: Log::ReadAppendersFromConfig() (Log.cpp:244)
  by 0x15A31B4: Log::LoadFromConfig() (Log.cpp:469)
  by 0x15A053B: Log::Log() (Log.cpp:35)
  by 0xF75CD1: ACE_Singleton<Log, ACE_Thread_Mutex>::ACE_Singleton() (Singleton.inl:13)
  by 0xF754A4: ACE_Singleton<Log, ACE_Thread_Mutex>::instance() (Singleton.cpp:91)
  by 0xF8351A: main (Main.cpp:135)
2013-09-13 19:59:50 +02:00
jackpoz
9578b5f87a Core/Thread: Fix race condition converting time values to local time
Replace thread-unsafe localtime() http://www.cplusplus.com/reference/ctime/localtime/ with thread-safe portable ACE_OS::localtime_r() .

Helgrind log:
 Possible data race during read of size 4 at 0x6F183C0 by thread #1
 Locks held: none
  at 0x14E72E3: World::InitDailyQuestResetTime() (World.cpp:2772)
  by 0x14E3A01: World::SetInitialWorldSettings() (World.cpp:1790)
  by 0x101122A: Master::Run() (Master.cpp:164)
  by 0x101740C: main (Main.cpp:142)

 This conflicts with a previous write of size 4 by thread #2
 Locks held: none
  at 0x6C2D3BA: __tzfile_compute (tzfile.c:797)
  by 0x6C2D036: __tz_convert (tzset.c:627)
  by 0x164146C: LogMessage::getTimeStr(long) (Appender.cpp:23)
  by 0x1641550: LogMessage::getTimeStr() (Appender.cpp:31)
  by 0x1641722: Appender::write(LogMessage&) (Appender.cpp:80)
  by 0x1633FCE: Logger::write(LogMessage&) (Logger.cpp:83)
  by 0x16433D8: LogOperation::call() (LogOperation.cpp:29)
  by 0x16428A4: LogWorker::svc() (LogWorker.cpp:45)
2013-09-07 14:37:54 +02:00
Shauren
779a59e7e2 Core/Config: Refactored ConfigMgr
* Loading initial configuration files is now separate from loading any additional custom configs
2013-07-15 17:31:44 +02:00
Shauren
86d846e627 Core: Fixed windows compile 2013-05-13 18:10:20 +02:00
Spp
d1677b2db0 Core/Logging: Performance-related tweaks to logging system
All sLog->out* functions (except outCommand atm) are replaced with TC_LOG_* macros.
    Memleak fix
2013-05-13 15:07:36 +02:00
Spp
1a6a23ec96 Core/Misc: Minor optimizations (+code changes to reduce differences with 4.3.4 branch)
Core/Logging: Create new logger type "Cheat". Will be used to log all cheat attempts
2013-03-25 13:26:48 +01:00
Spp
480c6cf4dd Core/RBAC: Add .reload rbac command and prevent possible crash if rbac_permissions has wrong data 2013-02-27 03:30:53 +01:00
Spp
fd882a4e61 Core/Logging: Fix mem leak. Thanks to @Sar777 for the report 2013-02-21 01:10:58 +01:00
click
75994b3dd3 Core: Clean up whitespace, and remove a silly warning in boss_lurker_below.cpp 2013-02-07 00:19:19 +01:00
Spp
fa5dd4bd4e Core/Misc: Remove some calls to const_cast 2013-01-30 08:39:06 +01:00
Machiavelli
61495d18a3 Core/Log: Fix crash due to uninitialized variable 2013-01-25 21:40:21 +01:00
Spp
0d3cc3ae3a Core/Log: Fix console colors (missing change from 53a3373)
Closes #9051
2013-01-24 21:52:29 +01:00
Spp
53a3373a98 Core/Logging: Fix all possible crashes when using bad Appender config settings 2013-01-24 16:57:35 +01:00
springfieldking
389a4899f4 Update src/server/shared/Logging/Log.cpp
Fix crash when the last iter plus and change value
2013-01-24 22:26:11 +08:00
Spp
23b6a6a7cd Core/Log: Rotate logs when maximum size is exceeded, backup name will be "filename".datetime
- This is an addition to 39c2d89
2013-01-24 12:44:58 +01:00
Machiavelli
39c2d892f3 Core/Log: Allow configuring a maximum file size for a log file. If the file size is about to be exceeded, the core will create a new file titled <oldname>_.log and start outputting there. 2013-01-23 17:48:17 +01:00
Spp
526bdc0764 Core/Logging: Add config option to enable/disable asyncronous logging (disabled by default) 2013-01-16 09:52:49 +01:00
Spp
be3826825e Core/Logging: Use correct realmId when logging to DB 2013-01-16 08:59:56 +01:00
Spp
802657250c Core/Misc: Apply codestyle to multiple files 2013-01-14 09:50:59 +01:00
Vincent_Michael
cc65aba789 Update copyright note for 2013.
Happy new year.
2013-01-01 00:41:01 +01:00
Shauren
f1170ba0fb Core: Fixed some level 4 warnings (msvc) 2012-12-31 20:43:14 +01:00
Spp
2251d1bfae Core/Misc: Set mode 0644 for files 2012-11-27 13:03:12 +01:00
Spp
1925027aec Core/Logging: Add new log type for SOAP.
Closes #8201
2012-10-28 13:03:50 +01:00
Spp
1e50a08604 Core/Logging: Fix PlayerDump logging 2012-10-22 10:37:39 +02:00
Spp
f8846cdeaf Core/Utilities: Do not expose internal store structure in Tokens and rename it to Tokenizer 2012-10-02 11:54:41 +02:00
Spp
f0f97ab851 Core/Logging: Fix crash when trying to log a message while config is being reloaded
Closes #7878
2012-09-26 13:42:53 +02:00
Spp
358c6a26d6 Core: Warning fixes (Also some -pedantic under game folder) 2012-09-10 13:04:31 +02:00
Shauren
1e9fc84a12 Core: Warning fixes
C4100: 'x' : unreferenced formal parameter
C4310: cast truncates constant value
C4389: '==' : signed/unsigned mismatch
C4668: 'x' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C4701: potentially uninitialized local variable 'x' used
C4826: Conversion from 'HMODULE' to 'DWORD64' is sign-extended. This may cause unexpected runtime behavior.
C6067: Parameter '3' in call to 'sprintf' must be the address of the string
C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'CloseHandle'
2012-09-04 14:40:41 +02:00
Spp
7811e9100c Core/Logging: Delete player filename will now use guid_name format like old log system. (was set to account_name by error) 2012-09-01 21:18:01 +02:00
Spp
5cafe0ca01 Core/Logging: Fix delete player crash having logging player enabled.
closes #7437
2012-09-01 21:15:20 +02:00
Nay
5f1977cb1d Core: Fix many "errors"/warnings and coding style (1)
Extractors, worldserver, authserver, shared and collision affected

Errors were found using Cppcheck, open-source static analysis tool
2012-08-30 19:07:59 +01:00
Spp
5aee9433e1 Core/Logging: Minor optimization in ShouldLog 2012-08-27 12:56:45 +02:00
Spp
a566e3e58b Core/Logging: Move more log messages to LOG_FILTER_SERVER_LOADING 2012-08-16 11:02:46 +02:00
Spp
3c42401d66 Core/Logging: Set config options to behave like old log system. 2012-08-16 00:56:58 +02:00
Spp
8a1e7dd070 Core/Loading: Re-enable Server loading log 2012-08-16 00:23:44 +02:00