Fix logging during shutdown procedure.

Refs #5788
This commit is contained in:
Gerd von Egidy 2014-04-27 23:40:37 +02:00 committed by Gunnar Beutner
parent 3a294bbd5d
commit 3ece2ba643
3 changed files with 12 additions and 3 deletions

View File

@ -200,10 +200,9 @@ static void TerminateAndWaitForEnd(pid_t target)
int ret = kill(target, SIGTERM);
while(Utility::GetTime() < timeout && (ret==0 || errno!=ESRCH))
{
while (Utility::GetTime() < timeout && (ret == 0 || errno != ESRCH)) {
Utility::Sleep(0.1);
ret = kill(target, SIGTERM);
ret = kill(target, 0);
}
// timeout and the process still seems to live: kill it

View File

@ -42,6 +42,15 @@ void StreamLogger::Start(void)
m_Tty = false;
}
void StreamLogger::Stop(void)
{
Logger::Stop();
// make sure we flush the log data on shutdown, even if we don't call the destructor
if (m_Stream)
m_Stream->flush();
}
/**
* Destructor for the StreamLogger class.
*/

View File

@ -39,6 +39,7 @@ public:
DECLARE_PTR_TYPEDEFS(StreamLogger);
virtual void Start(void);
virtual void Stop(void);
~StreamLogger(void);
void BindStream(std::ostream *stream, bool ownsStream);