From cc61681484185f3c450fc0ab7efeb093c672d194 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Jul 2014 01:56:41 +0100 Subject: Revert "Write UDP statistics to the log, not just the console (e.g., "show queues")" Fixes http://opensimulator.org/mantis/view.php?id=7280 It can't be done this way because the stats data needs to show up on the console at all log levels, not just debug. But this means setting it to log at fatal, which is not appropriate for this stuff in the log. I understand the desire but this has to be done some other way, perhaps by (yet another) config parameter. Also, this was already being done with the ClientStatsReport but that also should be done in another way, I think. This reverts commit 5d534127663899cd5592c865b1d00855fce25854. --- OpenSim/Framework/Monitoring/StatsManager.cs | 53 ++++++++++++++++------------ 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 5c8d934..0bac247 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -30,8 +30,6 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; -using System.Reflection; -using log4net; using OpenSim.Framework; using OpenMetaverse.StructuredData; @@ -43,8 +41,6 @@ namespace OpenSim.Framework.Monitoring /// public static class StatsManager { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - // Subcommand used to list other stats. public const string AllSubCommand = "all"; @@ -102,7 +98,6 @@ namespace OpenSim.Framework.Monitoring public static void HandleShowStatsCommand(string module, string[] cmd) { ICommandConsole con = MainConsole.Instance; - StringBuilder report = new StringBuilder(); if (cmd.Length > 2) { @@ -116,8 +111,7 @@ namespace OpenSim.Framework.Monitoring if (categoryName == AllSubCommand) { - foreach (string report2 in GetAllStatsReports()) - report.AppendLine(report2); + OutputAllStatsToConsole(con); } else if (categoryName == ListSubCommand) { @@ -136,8 +130,7 @@ namespace OpenSim.Framework.Monitoring { if (String.IsNullOrEmpty(containerName)) { - foreach (string report2 in GetCategoryStatsReports(category)) - report.AppendLine(report2); + OutputCategoryStatsToConsole(con, category); } else { @@ -146,15 +139,14 @@ namespace OpenSim.Framework.Monitoring { if (String.IsNullOrEmpty(statName)) { - foreach (string report2 in GetContainerStatsReports(container)) - report.AppendLine(report2); + OutputContainerStatsToConsole(con, container); } else { Stat stat; if (container.TryGetValue(statName, out stat)) { - report.AppendLine(stat.ToConsoleString()); + OutputStatToConsole(con, stat); } else { @@ -176,18 +168,10 @@ namespace OpenSim.Framework.Monitoring { // Legacy if (SimExtraStats != null) - { - report.Append(SimExtraStats.Report()); - } + con.Output(SimExtraStats.Report()); else - { - foreach (string report2 in GetAllStatsReports()) - report.AppendLine(report2); - } + OutputAllStatsToConsole(con); } - - if (report.Length > 0) - m_log.Debug(string.Join(" ", cmd) + "\n" + report.ToString()); } public static List GetAllStatsReports() @@ -200,6 +184,12 @@ namespace OpenSim.Framework.Monitoring return reports; } + private static void OutputAllStatsToConsole(ICommandConsole con) + { + foreach (string report in GetAllStatsReports()) + con.Output(report); + } + private static List GetCategoryStatsReports( SortedDictionary> category) { @@ -211,6 +201,13 @@ namespace OpenSim.Framework.Monitoring return reports; } + private static void OutputCategoryStatsToConsole( + ICommandConsole con, SortedDictionary> category) + { + foreach (string report in GetCategoryStatsReports(category)) + con.Output(report); + } + private static List GetContainerStatsReports(SortedDictionary container) { List reports = new List(); @@ -221,6 +218,18 @@ namespace OpenSim.Framework.Monitoring return reports; } + private static void OutputContainerStatsToConsole( + ICommandConsole con, SortedDictionary container) + { + foreach (string report in GetContainerStatsReports(container)) + con.Output(report); + } + + private static void OutputStatToConsole(ICommandConsole con, Stat stat) + { + con.Output(stat.ToConsoleString()); + } + // Creates an OSDMap of the format: // { categoryName: { // containerName: { -- cgit v1.1