diff options
author | Justin Clark-Casey (justincc) | 2012-11-22 04:50:09 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-11-22 04:50:09 +0000 |
commit | 4c4379b50f22a40f6178e37259afc2689a0f2dd1 (patch) | |
tree | 648270efe28075b6024b735afe57726db84667a3 /OpenSim/Framework | |
parent | Make "show info" command available across all servers (diff) | |
download | opensim-SC_OLD-4c4379b50f22a40f6178e37259afc2689a0f2dd1.zip opensim-SC_OLD-4c4379b50f22a40f6178e37259afc2689a0f2dd1.tar.gz opensim-SC_OLD-4c4379b50f22a40f6178e37259afc2689a0f2dd1.tar.bz2 opensim-SC_OLD-4c4379b50f22a40f6178e37259afc2689a0f2dd1.tar.xz |
Make "set log level" command available across all servers
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 31 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/ServerBase.cs | 31 |
2 files changed, 31 insertions, 31 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 9560171..5e898ef 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -102,10 +102,6 @@ namespace OpenSim.Framework.Servers | |||
102 | "shutdown", | 102 | "shutdown", |
103 | "Quit the application", HandleQuit); | 103 | "Quit the application", HandleQuit); |
104 | 104 | ||
105 | m_console.Commands.AddCommand("General", false, "set log level", | ||
106 | "set log level <level>", | ||
107 | "Set the console logging level", HandleLogLevel); | ||
108 | |||
109 | m_console.Commands.AddCommand("General", false, "show threads", | 105 | m_console.Commands.AddCommand("General", false, "show threads", |
110 | "show threads", | 106 | "show threads", |
111 | "Show thread status", HandleShow); | 107 | "Show thread status", HandleShow); |
@@ -254,33 +250,6 @@ namespace OpenSim.Framework.Servers | |||
254 | Shutdown(); | 250 | Shutdown(); |
255 | } | 251 | } |
256 | 252 | ||
257 | private void HandleLogLevel(string module, string[] cmd) | ||
258 | { | ||
259 | if (null == m_consoleAppender) | ||
260 | { | ||
261 | Notice("No appender named Console found (see the log4net config file for this executable)!"); | ||
262 | return; | ||
263 | } | ||
264 | |||
265 | if (cmd.Length > 3) | ||
266 | { | ||
267 | string rawLevel = cmd[3]; | ||
268 | |||
269 | ILoggerRepository repository = LogManager.GetRepository(); | ||
270 | Level consoleLevel = repository.LevelMap[rawLevel]; | ||
271 | |||
272 | if (consoleLevel != null) | ||
273 | m_consoleAppender.Threshold = consoleLevel; | ||
274 | else | ||
275 | Notice( | ||
276 | String.Format( | ||
277 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", | ||
278 | rawLevel)); | ||
279 | } | ||
280 | |||
281 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); | ||
282 | } | ||
283 | |||
284 | /// <summary> | 253 | /// <summary> |
285 | /// Show help information | 254 | /// Show help information |
286 | /// </summary> | 255 | /// </summary> |
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 129b5fa..feffe6d 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs | |||
@@ -126,6 +126,10 @@ namespace OpenSim.Framework.Servers | |||
126 | 126 | ||
127 | m_console.Commands.AddCommand( | 127 | m_console.Commands.AddCommand( |
128 | "General", false, "show uptime", "show uptime", "Show server uptime", HandleShow); | 128 | "General", false, "show uptime", "show uptime", "Show server uptime", HandleShow); |
129 | |||
130 | m_console.Commands.AddCommand( | ||
131 | "General", false, "set log level", "set log level <level>", "Set the console logging level", | ||
132 | HandleLogLevel); | ||
129 | } | 133 | } |
130 | 134 | ||
131 | public virtual void HandleShow(string module, string[] cmd) | 135 | public virtual void HandleShow(string module, string[] cmd) |
@@ -148,6 +152,33 @@ namespace OpenSim.Framework.Servers | |||
148 | } | 152 | } |
149 | } | 153 | } |
150 | 154 | ||
155 | private void HandleLogLevel(string module, string[] cmd) | ||
156 | { | ||
157 | if (null == m_consoleAppender) | ||
158 | { | ||
159 | Notice("No appender named Console found (see the log4net config file for this executable)!"); | ||
160 | return; | ||
161 | } | ||
162 | |||
163 | if (cmd.Length > 3) | ||
164 | { | ||
165 | string rawLevel = cmd[3]; | ||
166 | |||
167 | ILoggerRepository repository = LogManager.GetRepository(); | ||
168 | Level consoleLevel = repository.LevelMap[rawLevel]; | ||
169 | |||
170 | if (consoleLevel != null) | ||
171 | m_consoleAppender.Threshold = consoleLevel; | ||
172 | else | ||
173 | Notice( | ||
174 | String.Format( | ||
175 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", | ||
176 | rawLevel)); | ||
177 | } | ||
178 | |||
179 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); | ||
180 | } | ||
181 | |||
151 | /// <summary> | 182 | /// <summary> |
152 | /// Return a report about the uptime of this server | 183 | /// Return a report about the uptime of this server |
153 | /// </summary> | 184 | /// </summary> |