From f4acaafd3a48ad8feecc2982c869954bb6326004 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 18 Dec 2008 02:42:26 +0000 Subject: * Added more articulate logging of HttpServer so we can diagnose issues. --- OpenSim/Framework/Servers/BaseHttpServer.cs | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 21c3011..5bf4480 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -47,6 +47,8 @@ namespace OpenSim.Framework.Servers public class BaseHttpServer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); + protected Thread m_workerThread; protected HttpListener m_httpListener; @@ -1363,6 +1365,8 @@ namespace OpenSim.Framework.Servers //m_httpListener.Prefixes.Add("http://10.1.1.5:" + m_port + "/"); m_httpListener2 = new HttpServer.HttpListener(IPAddress.Any, (int)m_port); m_httpListener2.ExceptionThrown += httpServerException; + m_httpListener2.LogWriter = httpserverlog; + } else { @@ -1512,4 +1516,38 @@ namespace OpenSim.Framework.Servers } } + public class HttpServerLogWriter : HttpServer.ILogWriter + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public HttpServerLogWriter() + { + } + + public void Write(object source, HttpServer.LogPrio priority, string message) + { + switch (priority) + { + case HttpServer.LogPrio.Debug: + m_log.DebugFormat("[{0}]: {1}", source.ToString(), message); + break; + case HttpServer.LogPrio.Error: + m_log.ErrorFormat("[{0}]: {1}", source.ToString(), message); + break; + case HttpServer.LogPrio.Info: + m_log.InfoFormat("[{0}]: {1}", source.ToString(), message); + break; + case HttpServer.LogPrio.Warning: + m_log.WarnFormat("[{0}]: {1}", source.ToString(), message); + break; + case HttpServer.LogPrio.Fatal: + m_log.ErrorFormat("[{0}]: FATAL! - {1}", source.ToString(), message); + break; + default: + break; + + } + } + + } } -- cgit v1.1