diff options
Diffstat (limited to 'OpenSim/Framework/Servers/BaseOpenSimServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 0ee21ac..852e1b1 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Timers; | ||
31 | using log4net; | 32 | using log4net; |
32 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
33 | using OpenSim.Framework.Statistics; | 34 | using OpenSim.Framework.Statistics; |
@@ -41,6 +42,12 @@ namespace OpenSim.Framework.Servers | |||
41 | { | 42 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 44 | ||
45 | /// <summary> | ||
46 | /// This will control a periodic log printout of the current 'show stats' (if they are active) for this | ||
47 | /// server. | ||
48 | /// </summary> | ||
49 | private Timer m_periodicLogStatsTimer = new Timer(60 * 60 * 1000); | ||
50 | |||
44 | protected ConsoleBase m_console; | 51 | protected ConsoleBase m_console; |
45 | 52 | ||
46 | /// <summary> | 53 | /// <summary> |
@@ -68,6 +75,20 @@ namespace OpenSim.Framework.Servers | |||
68 | { | 75 | { |
69 | m_startuptime = DateTime.Now; | 76 | m_startuptime = DateTime.Now; |
70 | m_version = VersionInfo.Version; | 77 | m_version = VersionInfo.Version; |
78 | |||
79 | m_periodicLogStatsTimer.Elapsed += new ElapsedEventHandler(LogStats); | ||
80 | m_periodicLogStatsTimer.Enabled = true; | ||
81 | } | ||
82 | |||
83 | /// <summary> | ||
84 | /// Print statistics to the logfile, if they are active | ||
85 | /// </summary> | ||
86 | protected void LogStats(object source, ElapsedEventArgs e) | ||
87 | { | ||
88 | if (m_stats != null) | ||
89 | { | ||
90 | m_log.Info(m_stats.Report()); | ||
91 | } | ||
71 | } | 92 | } |
72 | 93 | ||
73 | /// <summary> | 94 | /// <summary> |