From b799031010b978e3edaf9f128e31b498cff72afc Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 13 Jun 2008 16:58:24 +0000
Subject: * minor: Print out uptime as well as stats in periodic diagnostics
logging, so it's easier to tell which isntances each print out of information
is from
---
OpenSim/Framework/Servers/BaseHttpServer.cs | 4 +++-
OpenSim/Framework/Servers/BaseOpenSimServer.cs | 32 ++++++++++++++++++++++----
2 files changed, 30 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index ce351ca..a69cb63 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -558,7 +558,9 @@ namespace OpenSim.Framework.Servers
Encoding encoding = Encoding.UTF8;
StreamReader reader = new StreamReader(requestStream, encoding);
- string requestBody = reader.ReadToEnd();
+ //string requestBody = reader.ReadToEnd();
+ // avoid warning for now
+ reader.ReadToEnd();
reader.Close();
requestStream.Close();
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 433b040..62ff095 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -28,6 +28,7 @@
using System;
using System.IO;
using System.Reflection;
+using System.Text;
using System.Timers;
using log4net;
using OpenSim.Framework.Console;
@@ -46,7 +47,7 @@ namespace OpenSim.Framework.Servers
/// This will control a periodic log printout of the current 'show stats' (if they are active) for this
/// server.
///
- private Timer m_periodicLogStatsTimer = new Timer(60 * 60 * 1000);
+ private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
protected ConsoleBase m_console;
@@ -81,19 +82,37 @@ namespace OpenSim.Framework.Servers
m_startuptime = DateTime.Now;
m_version = VersionInfo.Version;
- m_periodicLogStatsTimer.Elapsed += new ElapsedEventHandler(LogStats);
- m_periodicLogStatsTimer.Enabled = true;
+ m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
+ m_periodicDiagnosticsTimer.Enabled = true;
}
///
/// Print statistics to the logfile, if they are active
///
- protected void LogStats(object source, ElapsedEventArgs e)
+ protected void LogDiagnostics(object source, ElapsedEventArgs e)
{
+ StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n");
+ sb.Append(GetUptimeReport());
+
if (m_stats != null)
{
- m_log.Info(m_stats.Report());
+ sb.Append(m_stats.Report());
}
+
+ m_log.Debug(sb);
+ }
+
+ ///
+ /// Return a report about the uptime of this server
+ ///
+ ///
+ protected string GetUptimeReport()
+ {
+ StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now));
+ sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime));
+ sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime));
+
+ return sb.ToString();
}
///
@@ -176,9 +195,12 @@ namespace OpenSim.Framework.Servers
break;
case "uptime":
+ Notice(GetUptimeReport());
+ /*
Notice("Time now is " + DateTime.Now);
Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString());
Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString());
+ */
break;
case "version":
--
cgit v1.1