From 14a4ff308190af61783f1c4c686bcfc3dfa07a4f Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 26 Apr 2007 17:50:25 +0000 Subject: [PATCH] added just what opensim needs...yet another command line option: -noverbose . cut down on the system console output (should really be stopping it all but not all output is going through OpenSim.Framework.Console) --- OpenGridServices.GridServer/Main.cs | 8 ++++---- OpenGridServices.UserServer/Main.cs | 2 +- OpenSim.Framework.Console/ConsoleBase.cs | 11 +++++++++-- OpenSim.RegionServer/OpenSimMain.cs | 4 ++-- OpenSim/Application.cs | 7 ++++++- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/OpenGridServices.GridServer/Main.cs b/OpenGridServices.GridServer/Main.cs index 55e2b00196..69cba9c9dd 100644 --- a/OpenGridServices.GridServer/Main.cs +++ b/OpenGridServices.GridServer/Main.cs @@ -80,7 +80,7 @@ namespace OpenGridServices.GridServer private OpenGrid_Main() { - m_console = new ConsoleBase("opengrid-gridserver-console.log", "OpenGrid", this); + m_console = new ConsoleBase("opengrid-gridserver-console.log", "OpenGrid", this, false); MainConsole.Instance = m_console; } @@ -101,9 +101,9 @@ namespace OpenGridServices.GridServer httpServer.AddRestHandler("GET", "/sims/", m_simProfileManager.RestGetSimMethod); httpServer.AddRestHandler("POST", "/sims/", m_simProfileManager.RestSetSimMethod); - httpServer.AddRestHandler("GET", "/regions/", m_simProfileManager.RestGetRegionMethod); - httpServer.AddRestHandler("POST", "/regions/", m_simProfileManager.RestSetRegionMethod); - + httpServer.AddRestHandler("GET", "/regions/", m_simProfileManager.RestGetRegionMethod); + httpServer.AddRestHandler("POST", "/regions/", m_simProfileManager.RestSetRegionMethod); + // lbsa71 : This code snippet taken from old http server. // I have no idea what this was supposed to do - looks like an infinite recursion to me. diff --git a/OpenGridServices.UserServer/Main.cs b/OpenGridServices.UserServer/Main.cs index c348a74b13..a0373f4671 100644 --- a/OpenGridServices.UserServer/Main.cs +++ b/OpenGridServices.UserServer/Main.cs @@ -68,7 +68,7 @@ namespace OpenGridServices.UserServer private OpenUser_Main() { - m_console = new ConsoleBase("opengrid-userserver-console.log", "OpenUser", this); + m_console = new ConsoleBase("opengrid-userserver-console.log", "OpenUser", this , false); MainConsole.Instance = m_console; } diff --git a/OpenSim.Framework.Console/ConsoleBase.cs b/OpenSim.Framework.Console/ConsoleBase.cs index 89c751f425..39d2b28057 100644 --- a/OpenSim.Framework.Console/ConsoleBase.cs +++ b/OpenSim.Framework.Console/ConsoleBase.cs @@ -8,6 +8,7 @@ namespace OpenSim.Framework.Console StreamWriter Log; public conscmd_callback cmdparser; public string componentname; + private bool disableOutput; // STUPID HACK ALERT!!!! STUPID HACK ALERT!!!!! // constype - the type of console to use (see enum ConsoleType) @@ -21,11 +22,11 @@ namespace OpenSim.Framework.Console // componentname - which component of the OGS system? (user, asset etc) // cmdparser - a reference to a conscmd_callback object - public ConsoleBase(string LogFile, string componentname, conscmd_callback cmdparser) + public ConsoleBase(string LogFile, string componentname, conscmd_callback cmdparser, bool disableSystemConsole ) { this.componentname = componentname; this.cmdparser = cmdparser; - + this.disableOutput = disableSystemConsole; System.Console.WriteLine("ServerConsole.cs - creating new local console"); System.Console.WriteLine("Logs will be saved to current directory in " + LogFile); Log = File.AppendText(LogFile); @@ -42,14 +43,20 @@ namespace OpenSim.Framework.Console public void Write(string format, params object[] args) { Log.Write(format, args); + if(!disableOutput) + { System.Console.Write(format, args); + } return; } public void WriteLine(string format, params object[] args) { Log.WriteLine(format, args); + if(!disableOutput) + { System.Console.WriteLine(format, args); + } return; } diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index 0ced749794..4375f74d82 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs @@ -90,14 +90,14 @@ namespace OpenSim protected ConsoleBase m_console; - public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile) + public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool verbose) { this.configFileSetup = useConfigFile; m_sandbox = sandBoxMode; m_loginserver = startLoginServer; m_physicsEngine = physicsEngine; - m_console = new ConsoleBase("region-console.log", "Region", this); + m_console = new ConsoleBase("region-console.log", "Region", this, verbose); OpenSim.Framework.Console.MainConsole.Instance = m_console; } diff --git a/OpenSim/Application.cs b/OpenSim/Application.cs index 56fcf53ca3..6adc5408b8 100644 --- a/OpenSim/Application.cs +++ b/OpenSim/Application.cs @@ -21,6 +21,7 @@ namespace OpenSim bool userAccounts = false; bool gridLocalAsset = false; bool useConfigFile = false; + bool noverbose = false; for (int i = 0; i < args.Length; i++) { @@ -55,9 +56,13 @@ namespace OpenSim { useConfigFile = true; } + if (args[i] == "-noverbose") + { + noverbose = true; + } } - OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine, useConfigFile); + OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine, useConfigFile, noverbose); // OpenSimRoot.Instance.Application = sim; sim.m_sandbox = sandBoxMode; sim.user_accounts = userAccounts;