From b4d128c811cd5b0344cc2cae1663e17f2951d183 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 12 May 2008 13:39:46 +0000 Subject: [PATCH] From: Alan M Webb This patch just tightens up console handling in BasOpenSimServer and removes (or redirects) a couple of messages that were being issued using Console.Writeline. --- OpenSim/Framework/Console/ConsoleBase.cs | 2 -- .../Framework/Servers/BaseOpenSimServer.cs | 29 +++++++++++++++---- .../3Di/RegionProxy/RegionProxyPlugin.cs | 4 +-- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index b33654576b..79fe1d455b 100644 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -49,8 +49,6 @@ namespace OpenSim.Framework.Console m_componentName = componentname; m_cmdParser = cmdparser; - System.Console.WriteLine("Creating new local console"); - m_log.Info("[" + m_componentName + "]: Started at " + DateTime.Now.ToString()); } diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index af25ef4016..b8ad83a9c8 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -54,7 +54,10 @@ namespace OpenSim.Framework.Servers /// public virtual void Shutdown() { - m_console.Close(); + if(m_console != null) + { + m_console.Close(); + } Environment.Exit(0); } @@ -68,9 +71,9 @@ namespace OpenSim.Framework.Servers switch (command) { case "help": - m_console.Notice("quit - equivalent to shutdown."); - m_console.Notice("show uptime - show server startup and uptime."); - m_console.Notice("shutdown - shutdown the server.\n"); + Notice("quit - equivalent to shutdown."); + Notice("show uptime - show server startup and uptime."); + Notice("shutdown - shutdown the server.\n"); break; case "show": @@ -96,10 +99,24 @@ namespace OpenSim.Framework.Servers switch (ShowWhat) { case "uptime": - m_console.Notice("Server has been running since " + m_startuptime.ToString()); - m_console.Notice("That is " + (DateTime.Now - 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()); break; } } + + /// + /// Console output is only possible if a console has been established. + /// That is something that cannot be determined within this class. So + /// all attempts to use the console MUST be verified. + /// + private void Notice(string msg) + { + if(m_console != null) + { + m_console.Notice(msg); + } + } + } } diff --git a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs index e8ae8a911f..16470de0c4 100644 --- a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs +++ b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs @@ -71,7 +71,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy public void Initialise(OpenSimMain openSim) { - Console.WriteLine("Starting proxy"); + m_log.Info("Starting proxy"); string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", ""); if (proxyURL.Length == 0) return; @@ -543,4 +543,4 @@ namespace OpenSim.ApplicationPlugins.RegionProxy #endregion } -} \ No newline at end of file +}