aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring/JobEngine.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-09-09 18:42:02 +0100
committerJustin Clark-Casey (justincc)2014-11-25 23:18:38 +0000
commitd3ed5de77d60ed87aff5b9caddd6dbd3c04c3ba9 (patch)
tree37ed72c9a9dfc21edd6ba4ca25169da582dac589 /OpenSim/Framework/Monitoring/JobEngine.cs
parentTemporarily add root agent rez attachments work to job engine if it is runnin... (diff)
downloadopensim-SC-d3ed5de77d60ed87aff5b9caddd6dbd3c04c3ba9.zip
opensim-SC-d3ed5de77d60ed87aff5b9caddd6dbd3c04c3ba9.tar.gz
opensim-SC-d3ed5de77d60ed87aff5b9caddd6dbd3c04c3ba9.tar.bz2
opensim-SC-d3ed5de77d60ed87aff5b9caddd6dbd3c04c3ba9.tar.xz
Add loglevel to jobengine that can be controlled via "debug jobengine loglevel <level>".
Defaults to 0 Level 1 currently does verbose logging about every queued and processed job.
Diffstat (limited to 'OpenSim/Framework/Monitoring/JobEngine.cs')
-rw-r--r--OpenSim/Framework/Monitoring/JobEngine.cs32
1 files changed, 26 insertions, 6 deletions
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
52 { 52 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 54
55 public int LogLevel { get; set; }
56
55 public bool IsRunning { get; private set; } 57 public bool IsRunning { get; private set; }
56 58
57 /// <summary> 59 /// <summary>
@@ -186,7 +188,8 @@ namespace OpenSim.Framework.Monitoring
186 188
187 public bool QueueRequest(string name, WaitCallback req, object o) 189 public bool QueueRequest(string name, WaitCallback req, object o)
188 { 190 {
189 m_log.DebugFormat("[JOB ENGINE]: Queued job {0}", name); 191 if (LogLevel >= 1)
192 m_log.DebugFormat("[JOB ENGINE]: Queued job {0}", name);
190 193
191 if (m_requestQueue.Count < m_requestQueue.BoundedCapacity) 194 if (m_requestQueue.Count < m_requestQueue.BoundedCapacity)
192 { 195 {
@@ -240,9 +243,14 @@ namespace OpenSim.Framework.Monitoring
240 // } 243 // }
241 // } 244 // }
242 245
243 m_log.DebugFormat("[JOB ENGINE]: Processing job {0}", m_currentJob.Name); 246 if (LogLevel >= 1)
247 m_log.DebugFormat("[JOB ENGINE]: Processing job {0}", m_currentJob.Name);
248
244 m_currentJob.Callback.Invoke(m_currentJob.O); 249 m_currentJob.Callback.Invoke(m_currentJob.O);
245 m_log.DebugFormat("[JOB ENGINE]: Processed job {0}", m_currentJob.Name); 250
251 if (LogLevel >= 1)
252 m_log.DebugFormat("[JOB ENGINE]: Processed job {0}", m_currentJob.Name);
253
246 m_currentJob = null; 254 m_currentJob = null;
247 } 255 }
248 } 256 }
@@ -258,9 +266,9 @@ namespace OpenSim.Framework.Monitoring
258// if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) 266// if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
259// return; 267// return;
260 268
261 if (args.Length != 3) 269 if (args.Length < 3)
262 { 270 {
263 MainConsole.Instance.Output("Usage: debug jobengine <stop|start|status>"); 271 MainConsole.Instance.Output("Usage: debug jobengine <stop|start|status|loglevel>");
264 return; 272 return;
265 } 273 }
266 274
@@ -282,6 +290,18 @@ namespace OpenSim.Framework.Monitoring
282 MainConsole.Instance.OutputFormat("Current job {0}", m_currentJob != null ? m_currentJob.Name : "none"); 290 MainConsole.Instance.OutputFormat("Current job {0}", m_currentJob != null ? m_currentJob.Name : "none");
283 MainConsole.Instance.OutputFormat( 291 MainConsole.Instance.OutputFormat(
284 "Jobs waiting: {0}", IsRunning ? m_requestQueue.Count.ToString() : "n/a"); 292 "Jobs waiting: {0}", IsRunning ? m_requestQueue.Count.ToString() : "n/a");
293 MainConsole.Instance.OutputFormat("Log Level: {0}", LogLevel);
294 }
295
296 else if (subCommand == "loglevel")
297 {
298// int logLevel;
299 int logLevel = int.Parse(args[3]);
300// if (ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out logLevel))
301// {
302 LogLevel = logLevel;
303 MainConsole.Instance.OutputFormat("Set log level to {0}", LogLevel);
304// }
285 } 305 }
286 else 306 else
287 { 307 {
@@ -289,4 +309,4 @@ namespace OpenSim.Framework.Monitoring
289 } 309 }
290 } 310 }
291 } 311 }
292} \ No newline at end of file 312}