* 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
parent
34746f5485
commit
b799031010
|
@ -558,7 +558,9 @@ namespace OpenSim.Framework.Servers
|
||||||
Encoding encoding = Encoding.UTF8;
|
Encoding encoding = Encoding.UTF8;
|
||||||
StreamReader reader = new StreamReader(requestStream, encoding);
|
StreamReader reader = new StreamReader(requestStream, encoding);
|
||||||
|
|
||||||
string requestBody = reader.ReadToEnd();
|
//string requestBody = reader.ReadToEnd();
|
||||||
|
// avoid warning for now
|
||||||
|
reader.ReadToEnd();
|
||||||
reader.Close();
|
reader.Close();
|
||||||
requestStream.Close();
|
requestStream.Close();
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework.Console;
|
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
|
/// This will control a periodic log printout of the current 'show stats' (if they are active) for this
|
||||||
/// server.
|
/// server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Timer m_periodicLogStatsTimer = new Timer(60 * 60 * 1000);
|
private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
|
||||||
|
|
||||||
protected ConsoleBase m_console;
|
protected ConsoleBase m_console;
|
||||||
|
|
||||||
|
@ -81,19 +82,37 @@ namespace OpenSim.Framework.Servers
|
||||||
m_startuptime = DateTime.Now;
|
m_startuptime = DateTime.Now;
|
||||||
m_version = VersionInfo.Version;
|
m_version = VersionInfo.Version;
|
||||||
|
|
||||||
m_periodicLogStatsTimer.Elapsed += new ElapsedEventHandler(LogStats);
|
m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
|
||||||
m_periodicLogStatsTimer.Enabled = true;
|
m_periodicDiagnosticsTimer.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Print statistics to the logfile, if they are active
|
/// Print statistics to the logfile, if they are active
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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)
|
if (m_stats != null)
|
||||||
{
|
{
|
||||||
m_log.Info(m_stats.Report());
|
sb.Append(m_stats.Report());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.Debug(sb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return a report about the uptime of this server
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -176,9 +195,12 @@ namespace OpenSim.Framework.Servers
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "uptime":
|
case "uptime":
|
||||||
|
Notice(GetUptimeReport());
|
||||||
|
/*
|
||||||
Notice("Time now is " + DateTime.Now);
|
Notice("Time now is " + DateTime.Now);
|
||||||
Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString());
|
Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString());
|
||||||
Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString());
|
Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString());
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "version":
|
case "version":
|
||||||
|
|
Loading…
Reference in New Issue