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/Servers/ServerBase.cs | |
parent | Make "show info" command available across all servers (diff) | |
download | opensim-SC-4c4379b50f22a40f6178e37259afc2689a0f2dd1.zip opensim-SC-4c4379b50f22a40f6178e37259afc2689a0f2dd1.tar.gz opensim-SC-4c4379b50f22a40f6178e37259afc2689a0f2dd1.tar.bz2 opensim-SC-4c4379b50f22a40f6178e37259afc2689a0f2dd1.tar.xz |
Make "set log level" command available across all servers
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/ServerBase.cs | 31 |
1 files changed, 31 insertions, 0 deletions
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> |