From d3ed5de77d60ed87aff5b9caddd6dbd3c04c3ba9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Sep 2014 18:42:02 +0100 Subject: Add loglevel to jobengine that can be controlled via "debug jobengine loglevel ". Defaults to 0 Level 1 currently does verbose logging about every queued and processed job. --- OpenSim/Framework/Monitoring/JobEngine.cs | 32 +++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/Monitoring') diff --git a/OpenSim/Framework/Monitoring/JobEngine.cs b/OpenSim/Framework/Monitoring/JobEngine.cs index b401a5c..ea2203f 100644 --- a/OpenSim/Framework/Monitoring/JobEngine.cs +++ b/OpenSim/Framework/Monitoring/JobEngine.cs @@ -52,6 +52,8 @@ namespace OpenSim.Framework.Monitoring { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public int LogLevel { get; set; } + public bool IsRunning { get; private set; } /// @@ -186,7 +188,8 @@ namespace OpenSim.Framework.Monitoring public bool QueueRequest(string name, WaitCallback req, object o) { - m_log.DebugFormat("[JOB ENGINE]: Queued job {0}", name); + if (LogLevel >= 1) + m_log.DebugFormat("[JOB ENGINE]: Queued job {0}", name); if (m_requestQueue.Count < m_requestQueue.BoundedCapacity) { @@ -240,9 +243,14 @@ namespace OpenSim.Framework.Monitoring // } // } - m_log.DebugFormat("[JOB ENGINE]: Processing job {0}", m_currentJob.Name); + if (LogLevel >= 1) + m_log.DebugFormat("[JOB ENGINE]: Processing job {0}", m_currentJob.Name); + m_currentJob.Callback.Invoke(m_currentJob.O); - m_log.DebugFormat("[JOB ENGINE]: Processed job {0}", m_currentJob.Name); + + if (LogLevel >= 1) + m_log.DebugFormat("[JOB ENGINE]: Processed job {0}", m_currentJob.Name); + m_currentJob = null; } } @@ -258,9 +266,9 @@ namespace OpenSim.Framework.Monitoring // if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) // return; - if (args.Length != 3) + if (args.Length < 3) { - MainConsole.Instance.Output("Usage: debug jobengine "); + MainConsole.Instance.Output("Usage: debug jobengine "); return; } @@ -282,6 +290,18 @@ namespace OpenSim.Framework.Monitoring MainConsole.Instance.OutputFormat("Current job {0}", m_currentJob != null ? m_currentJob.Name : "none"); MainConsole.Instance.OutputFormat( "Jobs waiting: {0}", IsRunning ? m_requestQueue.Count.ToString() : "n/a"); + MainConsole.Instance.OutputFormat("Log Level: {0}", LogLevel); + } + + else if (subCommand == "loglevel") + { +// int logLevel; + int logLevel = int.Parse(args[3]); +// if (ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out logLevel)) +// { + LogLevel = logLevel; + MainConsole.Instance.OutputFormat("Set log level to {0}", LogLevel); +// } } else { @@ -289,4 +309,4 @@ namespace OpenSim.Framework.Monitoring } } } -} \ No newline at end of file +} -- cgit v1.1