From 335d167eadd017539f4ee9ffe2536dac6a2f7d44 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 2 Apr 2012 00:48:36 -0400 Subject: [PATCH] Added some logging --- .../IntegrationService/IntegrationService.cs | 6 +++- .../IntegrationServiceBase.cs | 31 +++++++++++++++++++ prebuild.xml | 1 + 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/IntegrationService/IntegrationService.cs b/OpenSim/Services/IntegrationService/IntegrationService.cs index 32a6894bb6..3a65c08d60 100644 --- a/OpenSim/Services/IntegrationService/IntegrationService.cs +++ b/OpenSim/Services/IntegrationService/IntegrationService.cs @@ -25,6 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; +using System.Reflection; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; @@ -32,17 +34,19 @@ using OpenSim.Framework.Servers.HttpServer; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; using Nini.Config; - +using log4net; namespace OpenSim.Services.IntegrationService { public class IntegrationService : IntegrationServiceBase, IIntegrationService { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public IntegrationService(IConfigSource config, IHttpServer server) : base(config, server) { + m_log.InfoFormat("[IntegrationService]: Loaded"); } diff --git a/OpenSim/Services/IntegrationService/IntegrationServiceBase.cs b/OpenSim/Services/IntegrationService/IntegrationServiceBase.cs index 445827a124..200b90a401 100644 --- a/OpenSim/Services/IntegrationService/IntegrationServiceBase.cs +++ b/OpenSim/Services/IntegrationService/IntegrationServiceBase.cs @@ -26,6 +26,7 @@ */ using System; +using System.IO; using OpenSim.Services.Interfaces; using OpenSim.Services.Base; using OpenSim.Framework.Servers.HttpServer; @@ -34,6 +35,7 @@ using Nini.Config; using OpenSim.Framework; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using Mono.Addins; +using log4net; [assembly:AddinRoot ("IntegrationService", "1.0")] @@ -44,11 +46,14 @@ namespace OpenSim.Services.IntegrationService public interface IntegrationPlugin { void Init(IConfigSource config); + string Name{ get; } } public class IntegrationServiceBase : ServiceBase { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + protected IPresenceService m_PresenceService; protected IGridService m_GridService; protected IHttpServer m_Server; @@ -60,14 +65,20 @@ namespace OpenSim.Services.IntegrationService Object[] args = new Object[] { config }; + AddinManager.AddinLoaded += on_addinloaded_; + m_Server = server; + suppress_console_output_(true); AddinManager.Initialize ("."); AddinManager.Registry.Update (); + suppress_console_output_(false); + foreach (IntegrationPlugin cmd in AddinManager.GetExtensionObjects("/OpenSim/IntegrationService")) { cmd.Init (config); server.AddStreamHandler((IRequestHandler)cmd); + m_log.InfoFormat("[Integration]: Loading IntegrationService plugin {0}", cmd.Name); } m_IntegrationServerConfig = config.Configs["IntegrationService"]; @@ -87,5 +98,25 @@ namespace OpenSim.Services.IntegrationService m_PresenceService = LoadPlugin(presenceService, args); } + + private void on_addinloaded_(object sender, AddinEventArgs args) + { + m_log.Info ("[IntegrationService]: Plugin Loaded: " + args.AddinId); + } + + private static TextWriter prev_console_; + public void suppress_console_output_(bool save) + { + if (save) + { + prev_console_ = System.Console.Out; + System.Console.SetOut(new StreamWriter(Stream.Null)); + } + else + { + if (prev_console_ != null) + System.Console.SetOut(prev_console_); + } + } } } diff --git a/prebuild.xml b/prebuild.xml index 02315f621a..3f357b7a17 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1169,6 +1169,7 @@ +