mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Properly rotate logfiles on sustain.
This commit is contained in:
@@ -34,7 +34,7 @@ std::string StopSustain ()
|
|||||||
return "Terminating monitor";
|
return "Terminating monitor";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DoSustain ()
|
std::string DoSustain (std::string logFile)
|
||||||
{
|
{
|
||||||
int childCount = 0;
|
int childCount = 0;
|
||||||
pManager = getpid ();
|
pManager = getpid ();
|
||||||
@@ -72,7 +72,9 @@ std::string DoSustain ()
|
|||||||
while (kill (pChild, 0) == 0);
|
while (kill (pChild, 0) == 0);
|
||||||
|
|
||||||
rename ("core", boost::str (boost::format ("core.%d") % static_cast<int> (pChild)).c_str ());
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
std::string DoSustain ()
|
std::string DoSustain (std::string)
|
||||||
{
|
{
|
||||||
return std::string ();
|
return std::string ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,6 @@
|
|||||||
//
|
//
|
||||||
extern bool HaveSustain ();
|
extern bool HaveSustain ();
|
||||||
extern std::string StopSustain ();
|
extern std::string StopSustain ();
|
||||||
extern std::string DoSustain ();
|
extern std::string DoSustain (std::string logFile);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ int rippleMain (int argc, char** argv)
|
|||||||
if (HaveSustain () &&
|
if (HaveSustain () &&
|
||||||
!iResult && !vm.count ("parameters") && !vm.count ("fg") && !vm.count ("standalone") && !vm.count ("unittest"))
|
!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 ())
|
if (!logMe.empty ())
|
||||||
Log (lsWARNING) << logMe;
|
Log (lsWARNING) << logMe;
|
||||||
|
|||||||
Reference in New Issue
Block a user