mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 02:55:50 +00:00
Properly rotate logfiles on sustain.
This commit is contained in:
@@ -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 ();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
//
|
||||
extern bool HaveSustain ();
|
||||
extern std::string StopSustain ();
|
||||
extern std::string DoSustain ();
|
||||
extern std::string DoSustain (std::string logFile);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user