diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index c8a0c68270..740e55af95 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -127,12 +127,14 @@ namespace OpenSim.Framework /// 3 = full stack trace, including common threads /// public static int LogThreadPool { get; set; } + public static bool LogOverloads { get; set; } public static readonly int MAX_THREADPOOL_LEVEL = 3; static Util() { LogThreadPool = 0; + LogOverloads = true; } private static uint nextXferID = 5000; @@ -2172,7 +2174,7 @@ namespace OpenSim.Framework { long numRunning = numRunningThreadFuncs; - if (m_ThreadPool != null) + if (m_ThreadPool != null && LogOverloads) { if ((threadFuncOverloadMode == 0) && (numRunning >= m_ThreadPool.MaxThreads)) { @@ -2193,7 +2195,7 @@ namespace OpenSim.Framework threadInfo.StackTrace = full; threadInfo.LogThread = ShouldLogThread(partial); - if (loggingEnabled && threadInfo.LogThread) + if (threadInfo.LogThread) { m_log.DebugFormat("Queue threadfunc {0} (Queued {1}, Running {2}) {3}{4}", threadFuncNum, numQueued, numRunningThreadFuncs, diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 9d36986e73..feb3cf880a 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -154,6 +154,12 @@ namespace OpenSim proxyUrl = networkConfig.GetString("proxy_url", ""); proxyOffset = Int32.Parse(networkConfig.GetString("proxy_offset", "0")); } + + IConfig startupConfig = Config.Configs["Startup"]; + if (startupConfig != null) + { + Util.LogOverloads = startupConfig.GetBoolean("LogOverloads", true); + } } protected virtual void LoadPlugins() diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 2a92fbc0f6..df332ca48e 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -292,6 +292,14 @@ ; False items will be removed from the scene permanently UseTrashOnDelete = True + ; # + ; # Logging + ; # + + ; Force logging when the thread pool approaches an overload condition + ; Provides useful data for post-mortem analysis even in a production + ; system with reduced logging + LogOverloads = True [Map] ;WorldMapModule = "WorldMap"