From c71987b1a1403fa20654cc24b37448ca807ff363 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 23 Feb 2016 23:41:18 +0100 Subject: Core/Logging: Force synchronous logging after io_service shutdown - fixes logging on worldserver shutdown (cherry picked from commit a0b2be6c1d0ae17ad8a17692d77f2020bbb9296e) --- src/common/Logging/Log.cpp | 7 +++++++ src/common/Logging/Log.h | 1 + 2 files changed, 8 insertions(+) (limited to 'src/common') diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index de2c02bf2ed..f7a84fb8b47 100644 --- a/src/common/Logging/Log.cpp +++ b/src/common/Logging/Log.cpp @@ -337,6 +337,13 @@ void Log::Initialize(boost::asio::io_service* ioService) LoadFromConfig(); } +void Log::SetSynchronous() +{ + delete _strand; + _strand = nullptr; + _ioService = nullptr; +} + void Log::LoadFromConfig() { Close(); diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h index 6f9c5600775..062f14d525c 100644 --- a/src/common/Logging/Log.h +++ b/src/common/Logging/Log.h @@ -47,6 +47,7 @@ class Log static Log* instance(); void Initialize(boost::asio::io_service* ioService); + void SetSynchronous(); // Not threadsafe - should only be called from main() after all threads are joined void LoadFromConfig(); void Close(); bool ShouldLog(std::string const& type, LogLevel level) const; -- cgit v1.2.3