silence output by default in release mode for things we can't do much about on a live server... TODO: @cekis can we find a nice way of silencing or outputting java stack dumps into a file instead of the console?

This commit is contained in:
DarthArgus
2016-12-09 21:02:00 +00:00
parent bf396ac2a2
commit 802af495dc
12 changed files with 64 additions and 46 deletions
@@ -73,6 +73,7 @@ void ConfigServerScript::install(void)
KEY_BOOL (allowDebugSpeakMessages, true);
KEY_BOOL (disableScriptLogs, false);
KEY_BOOL (logBalance, false);
KEY_BOOL (printStacks, false);
int index = 0;
char const * result = 0;
@@ -17,16 +17,17 @@ class ConfigServerScript
struct Data
{
// script data
// script data
const char * scriptPath; // location of scripts
const char * javaLibPath; // location of jvm files
const char * javaDebugPort; // ip port we connect to for remote debugging
bool useRemoteDebugJava; // flag to use the jvm for remote debugging
bool allowBuildClusterScriptAttach; //used only on the build cluster for attaching scripts without a VM.
bool allowDebugConsoleMessages; //used only on the build cluster for attaching scripts without a VM.
bool allowDebugSpeakMessages; //used to enable/disable the debugSpeakMessage script function
bool disableScriptLogs;
bool logBalance;
bool useRemoteDebugJava; // flag to use the jvm for remote debugging
bool allowBuildClusterScriptAttach; //used only on the build cluster for attaching scripts without a VM.
bool allowDebugConsoleMessages; //used only on the build cluster for attaching scripts without a VM.
bool allowDebugSpeakMessages; //used to enable/disable the debugSpeakMessage script function
bool disableScriptLogs;
bool logBalance;
bool printStacks;
};
private:
@@ -42,15 +43,17 @@ class ConfigServerScript
static const char * getJavaLibPath (void);
static const char * getJavaDebugPort (void);
static bool getUseRemoteDebugJava (void);
static bool getAllowBuildClusterScriptAttach();
static bool allowDebugConsoleMessages();
static bool allowDebugSpeakMessages();
static bool getDisableScriptLogs();
static bool getLogBalance();
static bool getAllowBuildClusterScriptAttach();
static bool allowDebugConsoleMessages();
static bool allowDebugSpeakMessages();
static bool getDisableScriptLogs();
static bool getLogBalance();
static bool hasJavaOptions();
static int getNumberOfJavaOptions();
static char const * getJavaOptions(int index);
static bool getPrintStacks();
static bool hasJavaOptions();
static int getNumberOfJavaOptions();
static char const * getJavaOptions(int index);
};
inline const char *ConfigServerScript::getScriptPath(void)
@@ -112,6 +115,15 @@ inline bool ConfigServerScript::getLogBalance()
return data->logBalance;
}
inline bool ConfigServerScript::getPrintStacks()
{
#ifdef _DEBUG
return true;
#else
return data->printStacks;
#endif
}
//-----------------------------------------------------------------------
@@ -2183,7 +2183,8 @@ jlong JavaLibrary::getFreeJavaMemory()
*/
void JavaLibrary::printJavaStack()
{
ms_env->CallStaticVoidMethod(ms_clsThread, ms_midThreadDumpStack);
if (ConfigServerScript::getPrintStacks())
ms_env->CallStaticVoidMethod(ms_clsThread, ms_midThreadDumpStack);
}
/**