Properly rotate logfiles on sustain.

This commit is contained in:
JoelKatz
2013-07-21 23:11:49 -07:00
parent f466fcf93b
commit 5c040e78bb
3 changed files with 7 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ std::string StopSustain ()
return "Terminating monitor";
}
std::string DoSustain ()
std::string DoSustain (std::string logFile)
{
int childCount = 0;
pManager = getpid ();
@@ -72,7 +72,9 @@ std::string DoSustain ()
while (kill (pChild, 0) == 0);
rename ("core", boost::str (boost::format ("core.%d") % static_cast<int> (pChild)).c_str ());
rename ("debug.log", boost::str (boost::format ("debug.log.%d") % static_cast<int> (pChild)).c_str ());
if (!logFile.empty())
rename (logFile.c_str(),
boost::str (boost::format ("%s.%d") % logFile % static_cast<int> (pChild)).c_str ());
}
}
@@ -82,7 +84,7 @@ bool HaveSustain ()
{
return false;
}
std::string DoSustain ()
std::string DoSustain (std::string)
{
return std::string ();
}

View File

@@ -15,6 +15,6 @@
//
extern bool HaveSustain ();
extern std::string StopSustain ();
extern std::string DoSustain ();
extern std::string DoSustain (std::string logFile);
#endif

View File

@@ -299,7 +299,7 @@ int rippleMain (int argc, char** argv)
if (HaveSustain () &&
!iResult && !vm.count ("parameters") && !vm.count ("fg") && !vm.count ("standalone") && !vm.count ("unittest"))
{
std::string logMe = DoSustain ();
std::string logMe = DoSustain (theConfig.DEBUG_LOGFILE.c_str());
if (!logMe.empty ())
Log (lsWARNING) << logMe;