aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-19 17:57:40 +0000
committerJustin Clarke Casey2009-02-19 17:57:40 +0000
commit4550093353a8645d80e1fed8d763f12b279e98a0 (patch)
tree61fb0b5ed67c2b06c42c74db3e4658d6209ea647 /OpenSim/Framework/Servers
parent* refactor: Rename new class AssetGatherer to UuidGatherer to reflect what it... (diff)
downloadopensim-SC_OLD-4550093353a8645d80e1fed8d763f12b279e98a0.zip
opensim-SC_OLD-4550093353a8645d80e1fed8d763f12b279e98a0.tar.gz
opensim-SC_OLD-4550093353a8645d80e1fed8d763f12b279e98a0.tar.bz2
opensim-SC_OLD-4550093353a8645d80e1fed8d763f12b279e98a0.tar.xz
* Fix http://opensimulator.org/mantis/view.php?id=3193
* Make it possible once again to set a console log level threshold in OpenSim.exe.config
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs96
1 files changed, 45 insertions, 51 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 4cbbecc..8ede8f5 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -56,6 +56,7 @@ namespace OpenSim.Framework.Servers
56 private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); 56 private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
57 57
58 protected ConsoleBase m_console; 58 protected ConsoleBase m_console;
59 protected OpenSimAppender m_consoleAppender;
59 60
60 /// <summary> 61 /// <summary>
61 /// Time at which this server was started 62 /// Time at which this server was started
@@ -103,8 +104,33 @@ namespace OpenSim.Framework.Servers
103 { 104 {
104 if (m_console != null) 105 if (m_console != null)
105 { 106 {
106 SetConsoleLogLevel(new string[] { "ALL" }); 107 ILoggerRepository repository = LogManager.GetRepository();
108 IAppender[] appenders = repository.GetAppenders();
107 109
110 foreach (IAppender appender in appenders)
111 {
112 if (appender.Name == "Console")
113 {
114 m_consoleAppender = (OpenSimAppender)appender;
115 break;
116 }
117 }
118
119 if (null == m_consoleAppender)
120 {
121 Notice("No appender named Console found (see the log4net config file for this executable)!");
122 }
123 else
124 {
125 m_consoleAppender.Console = m_console;
126
127 // If there is no threshold set then the threshold is effectively everything.
128 if (null == m_consoleAppender.Threshold)
129 m_consoleAppender.Threshold = Level.All;
130
131 Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
132 }
133
108 m_console.Commands.AddCommand("base", false, "quit", 134 m_console.Commands.AddCommand("base", false, "quit",
109 "quit", 135 "quit",
110 "Quit the application", HandleQuit); 136 "Quit the application", HandleQuit);
@@ -227,52 +253,6 @@ namespace OpenSim.Framework.Servers
227 } 253 }
228 254
229 /// <summary> 255 /// <summary>
230 /// Set the level of log notices being echoed to the console
231 /// </summary>
232 /// <param name="setParams"></param>
233 private void SetConsoleLogLevel(string[] setParams)
234 {
235 ILoggerRepository repository = LogManager.GetRepository();
236 IAppender[] appenders = repository.GetAppenders();
237 OpenSimAppender consoleAppender = null;
238
239 foreach (IAppender appender in appenders)
240 {
241 if (appender.Name == "Console")
242 {
243 consoleAppender = (OpenSimAppender)appender;
244 break;
245 }
246 }
247
248 if (null == consoleAppender)
249 {
250 Notice("No appender named Console found (see the log4net config file for this executable)!");
251 return;
252 }
253
254 consoleAppender.Console = m_console;
255
256 if (setParams.Length > 0)
257 {
258 Level consoleLevel = repository.LevelMap[setParams[0]];
259 if (consoleLevel != null)
260 consoleAppender.Threshold = consoleLevel;
261 else
262 Notice(
263 String.Format(
264 "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
265 setParams[0]));
266 }
267
268 // If there is no threshold set then the threshold is effectively everything.
269 Level thresholdLevel
270 = (null != consoleAppender.Threshold ? consoleAppender.Threshold : Level.All);
271
272 Notice(String.Format("Console log level is {0}", thresholdLevel));
273 }
274
275 /// <summary>
276 /// Performs initialisation of the scene, such as loading configuration from disk. 256 /// Performs initialisation of the scene, such as loading configuration from disk.
277 /// </summary> 257 /// </summary>
278 public virtual void Startup() 258 public virtual void Startup()
@@ -309,12 +289,26 @@ namespace OpenSim.Framework.Servers
309 289
310 private void HandleLogLevel(string module, string[] cmd) 290 private void HandleLogLevel(string module, string[] cmd)
311 { 291 {
312 if (cmd.Length > 3) 292 if (null == m_consoleAppender)
313 { 293 {
314 string level = cmd[3]; 294 Notice("No appender named Console found (see the log4net config file for this executable)!");
315 295 return;
316 SetConsoleLogLevel(new string[] { level });
317 } 296 }
297
298 string rawLevel = cmd[3];
299
300 ILoggerRepository repository = LogManager.GetRepository();
301 Level consoleLevel = repository.LevelMap[rawLevel];
302
303 if (consoleLevel != null)
304 m_consoleAppender.Threshold = consoleLevel;
305 else
306 Notice(
307 String.Format(
308 "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
309 rawLevel));
310
311 Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
318 } 312 }
319 313
320 /// <summary> 314 /// <summary>