mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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.
This commit is contained in:
@@ -49,7 +49,8 @@ void AppenderFile::_write(LogMessage const& message)
|
||||
{
|
||||
char namebuf[TRINITY_PATH_MAX];
|
||||
snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1.c_str());
|
||||
logfile = OpenFile(namebuf, mode, backup || exceedMaxSize);
|
||||
// always use "a" with dynamic name otherwise it could delete the log we wrote in last _write() call
|
||||
logfile = OpenFile(namebuf, "a", backup || exceedMaxSize);
|
||||
}
|
||||
else if (exceedMaxSize)
|
||||
logfile = OpenFile(filename, "w", true);
|
||||
|
||||
Reference in New Issue
Block a user