When setting debug http level, do this for all known http servers, not just the main instance.

0.7.3-extended
Justin Clark-Casey (justincc) 2012-06-15 01:24:36 +01:00
parent 2b4e97eeaf
commit 84d97b3bc0
3 changed files with 41 additions and 22 deletions

View File

@ -53,6 +53,16 @@ namespace OpenSim.Framework.Servers.HttpServer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
/// <summary>
/// Control the printing of certain debug messages.
/// </summary>
/// <remarks>
/// If DebugLevel >= 1, then short warnings are logged when receiving bad input data.
/// If DebugLevel >= 2, then long warnings are logged when receiving bad input data.
/// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged.
/// </remarks>
public int DebugLevel { get; set; }
private volatile int NotSocketErrors = 0;
public volatile bool HTTPDRunning = false;
@ -79,16 +89,6 @@ namespace OpenSim.Framework.Servers.HttpServer
private PollServiceRequestManager m_PollServiceManager;
/// <summary>
/// Control the printing of certain debug messages.
/// </summary>
/// <remarks>
/// If DebugLevel >= 1, then short warnings are logged when receiving bad input data.
/// If DebugLevel >= 2, then long warnings are logged when receiving bad input data.
/// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged.
/// </remarks>
public int DebugLevel { get; set; }
public uint SSLPort
{
get { return m_sslport; }

View File

@ -38,8 +38,23 @@ namespace OpenSim.Framework.Servers
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static BaseHttpServer instance = null;
private static Dictionary<uint, BaseHttpServer> m_Servers =
new Dictionary<uint, BaseHttpServer>();
private static Dictionary<uint, BaseHttpServer> m_Servers = new Dictionary<uint, BaseHttpServer>();
public static int DebugLevel
{
get { return s_debugLevel; }
set
{
s_debugLevel = value;
Instance.DebugLevel = s_debugLevel;
lock (m_Servers)
foreach (BaseHttpServer server in m_Servers.Values)
server.DebugLevel = s_debugLevel;
}
}
private static int s_debugLevel;
public static BaseHttpServer Instance
{
@ -53,6 +68,7 @@ namespace OpenSim.Framework.Servers
/// <param name='server'></param>
public static void AddHttpServer(BaseHttpServer server)
{
lock (m_Servers)
m_Servers.Add(server.Port, server);
}
@ -87,6 +103,8 @@ namespace OpenSim.Framework.Servers
if (instance != null && port == Instance.Port)
return Instance;
lock (m_Servers)
{
if (m_Servers.ContainsKey(port))
return m_Servers[port];
@ -97,6 +115,7 @@ namespace OpenSim.Framework.Servers
m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port);
m_Servers[port].Start();
}
return m_Servers[port];
}

View File

@ -911,7 +911,7 @@ namespace OpenSim
int newDebug;
if (int.TryParse(args[2], out newDebug))
{
MainServer.Instance.DebugLevel = newDebug;
MainServer.DebugLevel = newDebug;
MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug);
break;
}