From 84d7227dfd8fc7e673b3015e2b5495d1752e16a3 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 16 Jan 2014 15:08:45 +0200 Subject: 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 --- OpenSim/Framework/Servers/ServerBase.cs | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'OpenSim/Framework/Servers/ServerBase.cs') diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index c258ff6..fd56587 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -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"); -- cgit v1.1