From 8f55b9d735fbc975ce7a4b54e972c17ffbfb1f49 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sun, 22 Feb 2009 20:52:55 +0000 Subject: Mantis#3218. Thank you kindly, TLaukkan (Tommil) for a patch that: * Added log4net dependency to physxplugin in prebuild.xml. * Added missing m_log fields to classes. * Replaced Console.WriteLine with appropriate m_log.Xxxx * Tested that nant test target runs succesfully. * Tested that local opensim sandbox starts up without errors. --- .../Shared/Api/Implementation/LSL_Api.cs | 14 +++++++------ .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- .../Api/Implementation/Plugins/HttpRequest.cs | 2 +- .../Shared/Api/Implementation/Plugins/Timer.cs | 2 +- .../ScriptEngine/Shared/Api/Runtime/Executor.cs | 23 ++++++++++++---------- .../Shared/Api/Runtime/YieldProlog/YP.cs | 12 ++++++----- 6 files changed, 31 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5455b53..bc113db 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -58,6 +58,7 @@ using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; +using System.Reflection; namespace OpenSim.Region.ScriptEngine.Shared.Api { @@ -66,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected IScriptEngine m_ScriptEngine; protected SceneObjectPart m_host; protected uint m_localID; @@ -1135,7 +1137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetStatus(int status) { m_host.AddScriptLPS(1); - // Console.WriteLine(m_host.ToString() + " status is " + m_host.GetEffectiveObjectFlags().ToString()); + // m_log.Debug(m_host.ToString() + " status is " + m_host.GetEffectiveObjectFlags().ToString()); switch (status) { case ScriptBaseClass.STATUS_PHYSICS: @@ -2706,8 +2708,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api msg.fromAgentID = new Guid(m_host.UUID.ToString()); // fromAgentID.Guid; msg.toAgentID = new Guid(user); // toAgentID.Guid; msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here -// Console.WriteLine("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message); -// Console.WriteLine("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString()); +// m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message); +// m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString()); msg.timestamp = (uint)Util.UnixTimeSinceEpoch();// timestamp; //if (client != null) //{ @@ -7882,7 +7884,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } catch(Exception e) { - Console.WriteLine("[LSL_API]: llRequestSimulatorData" + e.ToString()); + m_log.Error("[LSL_API]: llRequestSimulatorData" + e.ToString()); return UUID.Zero.ToString(); } } @@ -9068,7 +9070,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); string data = enc.GetString(a.Data); - //Console.WriteLine(data); + //m_log.Debug(data); NotecardCache.Cache(id, data); AsyncCommands. DataserverPlugin.DataserverReply(id.ToString(), @@ -9114,7 +9116,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); string data = enc.GetString(a.Data); - //Console.WriteLine(data); + //m_log.Debug(data); NotecardCache.Cache(id, data); AsyncCommands. DataserverPlugin.DataserverReply(id.ToString(), diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 597592d..7834a83 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -842,7 +842,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api for (i=0;i /// Contains the script to execute functions in. /// @@ -92,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase /// public override Object InitializeLifetimeService() { - //Console.WriteLine("Executor: InitializeLifetimeService()"); + //m_log.Debug("Executor: InitializeLifetimeService()"); // return null; ILease lease = (ILease)base.InitializeLifetimeService(); @@ -108,7 +111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public scriptEvents GetStateEventFlags(string state) { - //Console.WriteLine("Get event flags for " + state); + //m_log.Debug("Get event flags for " + state); // Check to see if we've already computed the flags for this state scriptEvents eventFlags = scriptEvents.None; @@ -124,19 +127,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase foreach (KeyValuePair kvp in m_eventFlagsMap) { string evname = state + "_event_" + kvp.Key; - //Console.WriteLine("Trying event "+evname); + //m_log.Debug("Trying event "+evname); try { MethodInfo mi = type.GetMethod(evname); if (mi != null) { - //Console.WriteLine("Found handler for " + kvp.Key); + //m_log.Debug("Found handler for " + kvp.Key); eventFlags |= kvp.Value; } } catch(Exception) { - //Console.WriteLine("Exeption in GetMethod:\n"+e.ToString()); + //m_log.Debug("Exeption in GetMethod:\n"+e.ToString()); } } @@ -144,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase if (eventFlags != 0) m_stateEvents.Add(state, eventFlags); - //Console.WriteLine("Returning {0:x}", eventFlags); + //m_log.Debug("Returning {0:x}", eventFlags); return (eventFlags); } @@ -156,7 +159,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase string EventName = state + "_event_" + FunctionName; //#if DEBUG - //Console.WriteLine("ScriptEngine: Script event function name: " + EventName); + //m_log.Debug("ScriptEngine: Script event function name: " + EventName); //#endif if (Events.ContainsKey(EventName) == false) @@ -170,7 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } catch { - Console.WriteLine("Event {0}not found", EventName); + m_log.Error("Event "+EventName+" not found."); // Event name not found, cache it as not found Events.Add(EventName, null); } @@ -182,13 +185,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase if (ev == null) // No event by that name! { - //Console.WriteLine("ScriptEngine Can not find any event named: \String.Empty + EventName + "\String.Empty); + //m_log.Debug("ScriptEngine Can not find any event named: \String.Empty + EventName + "\String.Empty); return; } //cfk 2-7-08 dont need this right now and the default Linux build has DEBUG defined #if DEBUG - //Console.WriteLine("ScriptEngine: Executing function name: " + EventName); + //m_log.Debug("ScriptEngine: Executing function name: " + EventName); #endif // Found try diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs index 5a9b0aa..9cdffaa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs @@ -36,6 +36,7 @@ using System.Reflection; using System.Net.Sockets; using System.Text; using System.Text.RegularExpressions; +using log4net; namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog { @@ -45,6 +46,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog /// public class YP { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static Fail _fail = new Fail(); private static Repeat _repeat = new Repeat(); private static Dictionary> _predicatesStore = @@ -2341,7 +2343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog string results = ""; for (Match m = Regex.Match(inData,inPattern); m.Success; m=m.NextMatch()) { - //Console.WriteLine( m ); + //m_log.Debug( m ); results += presep+ m + postsep; } return results; @@ -2359,7 +2361,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog } catch { - Console.WriteLine("Failed to connect to server at {0}:999", "localhost"); + m_log.Error("Failed to connect to server at localhost:999"); return ""; } @@ -2379,16 +2381,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog streamWriter.Flush(); cycOutputString = streamReader.ReadLine(); - Console.WriteLine("Cycoutput:" + cycOutputString); + m_log.Debug("Cycoutput:" + cycOutputString); //streamWriter.WriteLine("Client Message"); - //Console.WriteLine("Client Message"); + //m_log.Debug("Client Message"); streamWriter.Flush(); } } catch { - Console.WriteLine("Exception reading from Server"); + m_log.Error("Exception reading from Server"); return ""; } // tidy up -- cgit v1.1