diff options
author | Jeff Ames | 2008-02-05 19:44:27 +0000 |
---|---|---|
committer | Jeff Ames | 2008-02-05 19:44:27 +0000 |
commit | 6ed5283bc06a62f38eb517e67b975832b603bf61 (patch) | |
tree | e5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Grid/ScriptServer | |
parent | Cut down on the number of packets sent during terraforming. Terraforming shou... (diff) | |
download | opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.zip opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2 opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.xz |
Converted logging to use log4net.
Changed LogBase to ConsoleBase, which handles console I/O.
This is mostly an in-place conversion, so lots of refactoring can still be done.
Diffstat (limited to '')
6 files changed, 21 insertions, 37 deletions
diff --git a/OpenSim/Grid/ScriptServer/Application.cs b/OpenSim/Grid/ScriptServer/Application.cs index 5857101..26bd426 100644 --- a/OpenSim/Grid/ScriptServer/Application.cs +++ b/OpenSim/Grid/ScriptServer/Application.cs | |||
@@ -37,6 +37,8 @@ namespace OpenSim.Grid.ScriptServer | |||
37 | 37 | ||
38 | private static void Main(string[] args) | 38 | private static void Main(string[] args) |
39 | { | 39 | { |
40 | log4net.Config.XmlConfigurator.Configure(); | ||
41 | |||
40 | AppDomain.CurrentDomain.UnhandledException += | 42 | AppDomain.CurrentDomain.UnhandledException += |
41 | new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); | 43 | new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); |
42 | 44 | ||
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs index 819a037..595acea 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs | |||
@@ -33,14 +33,12 @@ namespace OpenSim.Grid.ScriptServer | |||
33 | // Maintains connection and communication to a region | 33 | // Maintains connection and communication to a region |
34 | public class RegionConnectionManager : RegionBase | 34 | public class RegionConnectionManager : RegionBase |
35 | { | 35 | { |
36 | private LogBase m_log; | ||
37 | private ScriptServerMain m_ScriptServerMain; | 36 | private ScriptServerMain m_ScriptServerMain; |
38 | private object m_Connection; | 37 | private object m_Connection; |
39 | 38 | ||
40 | public RegionConnectionManager(ScriptServerMain scm, LogBase logger, object Connection) | 39 | public RegionConnectionManager(ScriptServerMain scm, object Connection) |
41 | { | 40 | { |
42 | m_ScriptServerMain = scm; | 41 | m_ScriptServerMain = scm; |
43 | m_log = logger; | ||
44 | m_Connection = Connection; | 42 | m_Connection = Connection; |
45 | } | 43 | } |
46 | 44 | ||
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs index 7d29129..524b8c4 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs | |||
@@ -38,13 +38,11 @@ namespace OpenSim.Grid.ScriptServer | |||
38 | 38 | ||
39 | private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>(); | 39 | private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>(); |
40 | 40 | ||
41 | private LogBase m_log; | ||
42 | private ScriptServerMain m_ScriptServerMain; | 41 | private ScriptServerMain m_ScriptServerMain; |
43 | 42 | ||
44 | public RegionCommManager(ScriptServerMain scm, LogBase logger) | 43 | public RegionCommManager(ScriptServerMain scm) |
45 | { | 44 | { |
46 | m_ScriptServerMain = scm; | 45 | m_ScriptServerMain = scm; |
47 | m_log = logger; | ||
48 | } | 46 | } |
49 | 47 | ||
50 | ~RegionCommManager() | 48 | ~RegionCommManager() |
@@ -96,9 +94,8 @@ namespace OpenSim.Grid.ScriptServer | |||
96 | // ~ ask scriptengines if they will accept script? | 94 | // ~ ask scriptengines if they will accept script? |
97 | // - Add script to shared communication channel towards that region | 95 | // - Add script to shared communication channel towards that region |
98 | 96 | ||
99 | |||
100 | // TODO: FAKING A CONNECTION | 97 | // TODO: FAKING A CONNECTION |
101 | Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null)); | 98 | Regions.Add(new RegionConnectionManager(m_ScriptServerMain, null)); |
102 | } | 99 | } |
103 | } | 100 | } |
104 | } \ No newline at end of file | 101 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs index c9c0fb0..4bb74f5 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs | |||
@@ -35,13 +35,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer | |||
35 | { | 35 | { |
36 | internal class ScriptEngineLoader | 36 | internal class ScriptEngineLoader |
37 | { | 37 | { |
38 | private LogBase m_log; | 38 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
39 | |||
40 | |||
41 | public ScriptEngineLoader(LogBase logger) | ||
42 | { | ||
43 | m_log = logger; | ||
44 | } | ||
45 | 39 | ||
46 | public ScriptServerInterfaces.ScriptEngine LoadScriptEngine(string EngineName) | 40 | public ScriptServerInterfaces.ScriptEngine LoadScriptEngine(string EngineName) |
47 | { | 41 | { |
@@ -55,7 +49,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer | |||
55 | } | 49 | } |
56 | catch (Exception e) | 50 | catch (Exception e) |
57 | { | 51 | { |
58 | m_log.Error("ScriptEngine", | 52 | m_log.Error("[ScriptEngine]: " + |
59 | "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + | 53 | "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + |
60 | e.StackTrace.ToString()); | 54 | e.StackTrace.ToString()); |
61 | } | 55 | } |
@@ -87,7 +81,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer | |||
87 | //} | 81 | //} |
88 | //catch (Exception e) | 82 | //catch (Exception e) |
89 | //{ | 83 | //{ |
90 | // m_log.Error("ScriptEngine", "Error loading assembly \String.Empty + FileName + "\": " + e.ToString()); | 84 | // m_log.Error("[ScriptEngine]: Error loading assembly \String.Empty + FileName + "\": " + e.ToString()); |
91 | //} | 85 | //} |
92 | 86 | ||
93 | 87 | ||
@@ -104,7 +98,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer | |||
104 | //} | 98 | //} |
105 | //catch (Exception e) | 99 | //catch (Exception e) |
106 | //{ | 100 | //{ |
107 | // m_log.Error("ScriptEngine", "Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); | 101 | // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); |
108 | //} | 102 | //} |
109 | 103 | ||
110 | ScriptServerInterfaces.ScriptEngine ret; | 104 | ScriptServerInterfaces.ScriptEngine ret; |
@@ -114,7 +108,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer | |||
114 | //} | 108 | //} |
115 | //catch (Exception e) | 109 | //catch (Exception e) |
116 | //{ | 110 | //{ |
117 | // m_log.Error("ScriptEngine", "Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); | 111 | // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); |
118 | //} | 112 | //} |
119 | 113 | ||
120 | return ret; | 114 | return ret; |
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs index 3bfca87..7976cb5 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs | |||
@@ -34,17 +34,15 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer | |||
34 | { | 34 | { |
35 | internal class ScriptEngineManager | 35 | internal class ScriptEngineManager |
36 | { | 36 | { |
37 | private LogBase m_log; | ||
38 | private ScriptEngineLoader ScriptEngineLoader; | 37 | private ScriptEngineLoader ScriptEngineLoader; |
39 | private List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>(); | 38 | private List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>(); |
40 | private ScriptServerMain m_ScriptServerMain; | 39 | private ScriptServerMain m_ScriptServerMain; |
41 | 40 | ||
42 | // Initialize | 41 | // Initialize |
43 | public ScriptEngineManager(ScriptServerMain scm, LogBase logger) | 42 | public ScriptEngineManager(ScriptServerMain scm) |
44 | { | 43 | { |
45 | m_ScriptServerMain = scm; | 44 | m_ScriptServerMain = scm; |
46 | m_log = logger; | 45 | ScriptEngineLoader = new ScriptEngineLoader(); |
47 | ScriptEngineLoader = new ScriptEngineLoader(m_log); | ||
48 | } | 46 | } |
49 | 47 | ||
50 | ~ScriptEngineManager() | 48 | ~ScriptEngineManager() |
diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs index 421467d..e2c83f1 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs | |||
@@ -40,11 +40,12 @@ namespace OpenSim.Grid.ScriptServer | |||
40 | { | 40 | { |
41 | public class ScriptServerMain : BaseOpenSimServer, conscmd_callback | 41 | public class ScriptServerMain : BaseOpenSimServer, conscmd_callback |
42 | { | 42 | { |
43 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
43 | // | 45 | // |
44 | // Root object. Creates objects used. | 46 | // Root object. Creates objects used. |
45 | // | 47 | // |
46 | private int listenPort = 8010; | 48 | private int listenPort = 8010; |
47 | private readonly string m_logFilename = ("scriptserver.log"); | ||
48 | 49 | ||
49 | // TEMP | 50 | // TEMP |
50 | public static ScriptServerInterfaces.ScriptEngine Engine; | 51 | public static ScriptServerInterfaces.ScriptEngine Engine; |
@@ -59,16 +60,15 @@ namespace OpenSim.Grid.ScriptServer | |||
59 | 60 | ||
60 | public ScriptServerMain() | 61 | public ScriptServerMain() |
61 | { | 62 | { |
62 | m_log = CreateLog(); | 63 | m_console = CreateConsole(); |
63 | |||
64 | 64 | ||
65 | // Set up script engine mananger | 65 | // Set up script engine mananger |
66 | ScriptEngines = new ScriptEngineManager(this, m_log); | 66 | ScriptEngines = new ScriptEngineManager(this); |
67 | 67 | ||
68 | // Load DotNetEngine | 68 | // Load DotNetEngine |
69 | Engine = ScriptEngines.LoadEngine("DotNetEngine"); | 69 | Engine = ScriptEngines.LoadEngine("DotNetEngine"); |
70 | IConfigSource config = null; | 70 | IConfigSource config = null; |
71 | Engine.InitializeEngine(null, null, m_log, false, Engine.GetScriptManager()); | 71 | Engine.InitializeEngine(null, null, false, Engine.GetScriptManager()); |
72 | 72 | ||
73 | 73 | ||
74 | // Set up server | 74 | // Set up server |
@@ -83,12 +83,12 @@ namespace OpenSim.Grid.ScriptServer | |||
83 | 83 | ||
84 | private void RPC_ReceiveCommand(int ID, string Command, object[] p) | 84 | private void RPC_ReceiveCommand(int ID, string Command, object[] p) |
85 | { | 85 | { |
86 | m_log.Notice("SERVER", "Received command: '" + Command + "'"); | 86 | m_log.Info("[SERVER]: Received command: '" + Command + "'"); |
87 | if (p != null) | 87 | if (p != null) |
88 | { | 88 | { |
89 | for (int i = 0; i < p.Length; i++) | 89 | for (int i = 0; i < p.Length; i++) |
90 | { | 90 | { |
91 | m_log.Notice("SERVER", "Param " + i + ": " + p[i].ToString()); | 91 | m_log.Info("[SERVER]: Param " + i + ": " + p[i].ToString()); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
@@ -102,14 +102,9 @@ namespace OpenSim.Grid.ScriptServer | |||
102 | { | 102 | { |
103 | } | 103 | } |
104 | 104 | ||
105 | protected LogBase CreateLog() | 105 | protected ConsoleBase CreateConsole() |
106 | { | 106 | { |
107 | if (!Directory.Exists(Util.logDir())) | 107 | return new ConsoleBase("ScriptServer", this); |
108 | { | ||
109 | Directory.CreateDirectory(Util.logDir()); | ||
110 | } | ||
111 | |||
112 | return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "ScriptServer", this, true); | ||
113 | } | 108 | } |
114 | } | 109 | } |
115 | } | 110 | } |