mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
Changed LogThreadPool to have 4 logging levels. Added console command "debug threadpool level" to set the logging level.
Resolves http://opensimulator.org/mantis/view.php?id=6945
This commit is contained in:
@@ -279,6 +279,17 @@ namespace OpenSim.Framework.Servers
|
||||
"debug threadpool status",
|
||||
"Show current debug threadpool parameters.",
|
||||
HandleDebugThreadpoolStatus);
|
||||
|
||||
m_console.Commands.AddCommand(
|
||||
"Debug", false, "debug threadpool level",
|
||||
"debug threadpool level 0.." + Util.MAX_THREADPOOL_LEVEL,
|
||||
"Turn on logging of activity in the main thread pool.",
|
||||
"Log levels:\n"
|
||||
+ " 0 = no logging\n"
|
||||
+ " 1 = only first line of stack trace; don't log common threads\n"
|
||||
+ " 2 = full stack trace; don't log common threads\n"
|
||||
+ " 3 = full stack trace, including common threads\n",
|
||||
HandleDebugThreadpoolLevel);
|
||||
|
||||
m_console.Commands.AddCommand(
|
||||
"Debug", false, "force gc",
|
||||
@@ -432,6 +443,33 @@ namespace OpenSim.Framework.Servers
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandleDebugThreadpoolLevel(string module, string[] cmdparams)
|
||||
{
|
||||
if (cmdparams.Length < 4)
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug threadpool level 0.." + Util.MAX_THREADPOOL_LEVEL);
|
||||
return;
|
||||
}
|
||||
|
||||
string rawLevel = cmdparams[3];
|
||||
int newLevel;
|
||||
|
||||
if (!int.TryParse(rawLevel, out newLevel))
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("{0} is not a valid debug level", rawLevel);
|
||||
return;
|
||||
}
|
||||
|
||||
if (newLevel < 0 || newLevel > Util.MAX_THREADPOOL_LEVEL)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0.." + Util.MAX_THREADPOOL_LEVEL, newLevel);
|
||||
return;
|
||||
}
|
||||
|
||||
Util.LogThreadPool = newLevel;
|
||||
MainConsole.Instance.OutputFormat("LogThreadPool set to {0}", newLevel);
|
||||
}
|
||||
|
||||
private void HandleForceGc(string module, string[] args)
|
||||
{
|
||||
Notice("Manually invoking runtime garbage collection");
|
||||
|
||||
Reference in New Issue
Block a user