aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Console/OpenSimAppender.cs7
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs85
-rw-r--r--OpenSim/Region/Application/OpenSim.cs1
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs1
4 files changed, 87 insertions, 7 deletions
diff --git a/OpenSim/Framework/Console/OpenSimAppender.cs b/OpenSim/Framework/Console/OpenSimAppender.cs
index ddd6d9a..2527977 100644
--- a/OpenSim/Framework/Console/OpenSimAppender.cs
+++ b/OpenSim/Framework/Console/OpenSimAppender.cs
@@ -32,17 +32,22 @@ using log4net.Core;
32 32
33namespace OpenSim.Framework.Console 33namespace OpenSim.Framework.Console
34{ 34{
35 /// <summary>
36 /// Writes log information out onto the console
37 /// </summary>
35 public class OpenSimAppender : AnsiColorTerminalAppender 38 public class OpenSimAppender : AnsiColorTerminalAppender
36 { 39 {
37 override protected void Append(LoggingEvent le) 40 override protected void Append(LoggingEvent le)
38 { 41 {
39 try { 42 try
43 {
40 string loggingMessage = RenderLoggingEvent(le); 44 string loggingMessage = RenderLoggingEvent(le);
41 45
42 string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)"; 46 string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)";
43 47
44 Regex RE = new Regex(regex, RegexOptions.Multiline); 48 Regex RE = new Regex(regex, RegexOptions.Multiline);
45 MatchCollection matches = RE.Matches(loggingMessage); 49 MatchCollection matches = RE.Matches(loggingMessage);
50
46 // Get some direct matches $1 $4 is a 51 // Get some direct matches $1 $4 is a
47 if (matches.Count == 1) 52 if (matches.Count == 1)
48 { 53 {
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 65c989d..e901b68 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -33,6 +33,9 @@ using System.Text;
33using System.Threading; 33using System.Threading;
34using System.Timers; 34using System.Timers;
35using log4net; 35using log4net;
36using log4net.Appender;
37using log4net.Core;
38using log4net.Repository;
36using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
37using OpenSim.Framework.Statistics; 40using OpenSim.Framework.Statistics;
38 41
@@ -120,6 +123,50 @@ namespace OpenSim.Framework.Servers
120 123
121 return sb.ToString(); 124 return sb.ToString();
122 } 125 }
126
127 /// <summary>
128 /// Set the level of log notices being echoed to the console
129 /// </summary>
130 /// <param name="setParams"></param>
131 private void SetConsoleLogLevel(string[] setParams)
132 {
133 ILoggerRepository repository = LogManager.GetRepository();
134 IAppender[] appenders = repository.GetAppenders();
135 OpenSimAppender consoleAppender = null;
136
137 foreach (IAppender appender in appenders)
138 {
139 if (appender.Name == "Console")
140 {
141 consoleAppender = (OpenSimAppender)appender;
142 break;
143 }
144 }
145
146 if (null == consoleAppender)
147 {
148 Notice("No appender named Console found (see the log4net config file for this executable)!");
149 return;
150 }
151
152 if (setParams.Length > 0)
153 {
154 Level consoleLevel = repository.LevelMap[setParams[0]];
155 if (consoleLevel != null)
156 consoleAppender.Threshold = consoleLevel;
157 else
158 Notice(
159 String.Format(
160 "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
161 setParams[0]));
162 }
163
164 // If there is no threshold set then the threshold is effectively everything.
165 Level thresholdLevel
166 = (null != consoleAppender.Threshold ? consoleAppender.Threshold : log4net.Core.Level.All);
167
168 Notice(String.Format("Console log level is {0}", thresholdLevel));
169 }
123 170
124 /// <summary> 171 /// <summary>
125 /// Performs initialisation of the scene, such as loading configuration from disk. 172 /// Performs initialisation of the scene, such as loading configuration from disk.
@@ -156,6 +203,7 @@ namespace OpenSim.Framework.Servers
156 Notice(""); 203 Notice("");
157 Notice("quit - equivalent to shutdown."); 204 Notice("quit - equivalent to shutdown.");
158 205
206 Notice("set log level [level] - change the console logging level only. For example, off or debug.");
159 Notice("show info - show server information (e.g. startup path)."); 207 Notice("show info - show server information (e.g. startup path).");
160 208
161 if (m_stats != null) 209 if (m_stats != null)
@@ -168,6 +216,10 @@ namespace OpenSim.Framework.Servers
168 216
169 break; 217 break;
170 218
219 case "set":
220 Set(cmdparams);
221 break;
222
171 case "show": 223 case "show":
172 if (cmdparams.Length > 0) 224 if (cmdparams.Length > 0)
173 { 225 {
@@ -180,15 +232,38 @@ namespace OpenSim.Framework.Servers
180 Shutdown(); 232 Shutdown();
181 break; 233 break;
182 } 234 }
183 } 235 }
236
237 /// <summary>
238 /// Set an OpenSim parameter
239 /// </summary>
240 /// <param name="setArgs">
241 /// The arguments given to the set command.
242 /// </param>
243 public virtual void Set(string[] setArgs)
244 {
245 // Temporary while we only have one command which takes at least two parameters
246 if (setArgs.Length < 2)
247 return;
248
249 if (setArgs[0] == "log" && setArgs[1] == "level")
250 {
251 string[] setParams = new string[setArgs.Length - 2];
252 Array.Copy(setArgs, 2, setParams, 0, setArgs.Length - 2);
253
254 SetConsoleLogLevel(setParams);
255 }
256 }
184 257
185 /// <summary> 258 /// <summary>
186 /// Outputs to the console information about the region 259 /// Outputs to the console information about the region
187 /// </summary> 260 /// </summary>
188 /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param> 261 /// <param name="showWhat">
189 public virtual void Show(string ShowWhat) 262 /// What information to display (valid arguments are "uptime", "users")
263 /// </param>
264 public virtual void Show(string showWhat)
190 { 265 {
191 switch (ShowWhat) 266 switch (showWhat)
192 { 267 {
193 case "info": 268 case "info":
194 Notice("Version: " + m_version); 269 Notice("Version: " + m_version);
@@ -226,7 +301,7 @@ namespace OpenSim.Framework.Servers
226 Notice("Version: " + m_version); 301 Notice("Version: " + m_version);
227 break; 302 break;
228 } 303 }
229 } 304 }
230 305
231 /// <summary> 306 /// <summary>
232 /// Console output is only possible if a console has been established. 307 /// Console output is only possible if a console has been established.
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index bf7044f..4664b0b 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -214,6 +214,7 @@ namespace OpenSim
214 { 214 {
215 base.RunCmd(command, cmdparams); 215 base.RunCmd(command, cmdparams);
216 RunPluginCommands(command , cmdparams); 216 RunPluginCommands(command , cmdparams);
217
217 switch (command) 218 switch (command)
218 { 219 {
219 case "clear-assets": 220 case "clear-assets":
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 4869858..b14b3db 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -48,7 +48,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
48{ 48{
49 public delegate bool PacketMethod(IClientAPI simClient, Packet packet); 49 public delegate bool PacketMethod(IClientAPI simClient, Packet packet);
50 50
51
52 /// <summary> 51 /// <summary>
53 /// Handles new client connections 52 /// Handles new client connections
54 /// Constructor takes a single Packet and authenticates everything 53 /// Constructor takes a single Packet and authenticates everything