diff options
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 38 |
1 files changed, 38 insertions, 0 deletions
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 | |||
47 | public class BaseHttpServer | 47 | public class BaseHttpServer |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); | ||
51 | |||
50 | 52 | ||
51 | protected Thread m_workerThread; | 53 | protected Thread m_workerThread; |
52 | protected HttpListener m_httpListener; | 54 | protected HttpListener m_httpListener; |
@@ -1363,6 +1365,8 @@ namespace OpenSim.Framework.Servers | |||
1363 | //m_httpListener.Prefixes.Add("http://10.1.1.5:" + m_port + "/"); | 1365 | //m_httpListener.Prefixes.Add("http://10.1.1.5:" + m_port + "/"); |
1364 | m_httpListener2 = new HttpServer.HttpListener(IPAddress.Any, (int)m_port); | 1366 | m_httpListener2 = new HttpServer.HttpListener(IPAddress.Any, (int)m_port); |
1365 | m_httpListener2.ExceptionThrown += httpServerException; | 1367 | m_httpListener2.ExceptionThrown += httpServerException; |
1368 | m_httpListener2.LogWriter = httpserverlog; | ||
1369 | |||
1366 | } | 1370 | } |
1367 | else | 1371 | else |
1368 | { | 1372 | { |
@@ -1512,4 +1516,38 @@ namespace OpenSim.Framework.Servers | |||
1512 | } | 1516 | } |
1513 | 1517 | ||
1514 | } | 1518 | } |
1519 | public class HttpServerLogWriter : HttpServer.ILogWriter | ||
1520 | { | ||
1521 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
1522 | |||
1523 | public HttpServerLogWriter() | ||
1524 | { | ||
1525 | } | ||
1526 | |||
1527 | public void Write(object source, HttpServer.LogPrio priority, string message) | ||
1528 | { | ||
1529 | switch (priority) | ||
1530 | { | ||
1531 | case HttpServer.LogPrio.Debug: | ||
1532 | m_log.DebugFormat("[{0}]: {1}", source.ToString(), message); | ||
1533 | break; | ||
1534 | case HttpServer.LogPrio.Error: | ||
1535 | m_log.ErrorFormat("[{0}]: {1}", source.ToString(), message); | ||
1536 | break; | ||
1537 | case HttpServer.LogPrio.Info: | ||
1538 | m_log.InfoFormat("[{0}]: {1}", source.ToString(), message); | ||
1539 | break; | ||
1540 | case HttpServer.LogPrio.Warning: | ||
1541 | m_log.WarnFormat("[{0}]: {1}", source.ToString(), message); | ||
1542 | break; | ||
1543 | case HttpServer.LogPrio.Fatal: | ||
1544 | m_log.ErrorFormat("[{0}]: FATAL! - {1}", source.ToString(), message); | ||
1545 | break; | ||
1546 | default: | ||
1547 | break; | ||
1548 | |||
1549 | } | ||
1550 | } | ||
1551 | |||
1552 | } | ||
1515 | } | 1553 | } |