Make "set log level" command available across all servers

connector_plugin
Justin Clark-Casey (justincc) 2012-11-22 04:50:09 +00:00
parent 45d1e6ab09
commit 4c4379b50f
3 changed files with 31 additions and 32 deletions

View File

@ -102,10 +102,6 @@ namespace OpenSim.Framework.Servers
"shutdown", "shutdown",
"Quit the application", HandleQuit); "Quit the application", HandleQuit);
m_console.Commands.AddCommand("General", false, "set log level",
"set log level <level>",
"Set the console logging level", HandleLogLevel);
m_console.Commands.AddCommand("General", false, "show threads", m_console.Commands.AddCommand("General", false, "show threads",
"show threads", "show threads",
"Show thread status", HandleShow); "Show thread status", HandleShow);
@ -254,33 +250,6 @@ namespace OpenSim.Framework.Servers
Shutdown(); Shutdown();
} }
private void HandleLogLevel(string module, string[] cmd)
{
if (null == m_consoleAppender)
{
Notice("No appender named Console found (see the log4net config file for this executable)!");
return;
}
if (cmd.Length > 3)
{
string rawLevel = cmd[3];
ILoggerRepository repository = LogManager.GetRepository();
Level consoleLevel = repository.LevelMap[rawLevel];
if (consoleLevel != null)
m_consoleAppender.Threshold = consoleLevel;
else
Notice(
String.Format(
"{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
rawLevel));
}
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
}
/// <summary> /// <summary>
/// Show help information /// Show help information
/// </summary> /// </summary>

View File

@ -126,6 +126,10 @@ namespace OpenSim.Framework.Servers
m_console.Commands.AddCommand( m_console.Commands.AddCommand(
"General", false, "show uptime", "show uptime", "Show server uptime", HandleShow); "General", false, "show uptime", "show uptime", "Show server uptime", HandleShow);
m_console.Commands.AddCommand(
"General", false, "set log level", "set log level <level>", "Set the console logging level",
HandleLogLevel);
} }
public virtual void HandleShow(string module, string[] cmd) public virtual void HandleShow(string module, string[] cmd)
@ -148,6 +152,33 @@ namespace OpenSim.Framework.Servers
} }
} }
private void HandleLogLevel(string module, string[] cmd)
{
if (null == m_consoleAppender)
{
Notice("No appender named Console found (see the log4net config file for this executable)!");
return;
}
if (cmd.Length > 3)
{
string rawLevel = cmd[3];
ILoggerRepository repository = LogManager.GetRepository();
Level consoleLevel = repository.LevelMap[rawLevel];
if (consoleLevel != null)
m_consoleAppender.Threshold = consoleLevel;
else
Notice(
String.Format(
"{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
rawLevel));
}
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
}
/// <summary> /// <summary>
/// Return a report about the uptime of this server /// Return a report about the uptime of this server
/// </summary> /// </summary>

View File

@ -285,7 +285,6 @@ namespace OpenSim.Server.Base
} }
} }
protected virtual void ReadConfig() protected virtual void ReadConfig()
{ {
} }