aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer/Main.cs
diff options
context:
space:
mode:
authorJeff Ames2008-02-05 19:44:27 +0000
committerJeff Ames2008-02-05 19:44:27 +0000
commit6ed5283bc06a62f38eb517e67b975832b603bf61 (patch)
treee5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Grid/GridServer/Main.cs
parentCut down on the number of packets sent during terraforming. Terraforming shou... (diff)
downloadopensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.zip
opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz
opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2
opensim-SC-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 'OpenSim/Grid/GridServer/Main.cs')
-rw-r--r--OpenSim/Grid/GridServer/Main.cs30
1 files changed, 14 insertions, 16 deletions
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs
index 8a522c2..ff4a888 100644
--- a/OpenSim/Grid/GridServer/Main.cs
+++ b/OpenSim/Grid/GridServer/Main.cs
@@ -39,6 +39,8 @@ namespace OpenSim.Grid.GridServer
39 /// </summary> 39 /// </summary>
40 public class OpenGrid_Main : BaseOpenSimServer, conscmd_callback 40 public class OpenGrid_Main : BaseOpenSimServer, conscmd_callback
41 { 41 {
42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43
42 public GridConfig Cfg; 44 public GridConfig Cfg;
43 45
44 public static OpenGrid_Main thegrid; 46 public static OpenGrid_Main thegrid;
@@ -54,11 +56,13 @@ namespace OpenSim.Grid.GridServer
54 [STAThread] 56 [STAThread]
55 public static void Main(string[] args) 57 public static void Main(string[] args)
56 { 58 {
59 log4net.Config.XmlConfigurator.Configure();
60
57 if (args.Length > 0) 61 if (args.Length > 0)
58 { 62 {
59 if (args[0] == "-setuponly") setuponly = true; 63 if (args[0] == "-setuponly") setuponly = true;
60 } 64 }
61 Console.WriteLine("Starting...\n"); 65 m_log.Info("Starting...\n");
62 66
63 thegrid = new OpenGrid_Main(); 67 thegrid = new OpenGrid_Main();
64 thegrid.Startup(); 68 thegrid.Startup();
@@ -68,23 +72,18 @@ namespace OpenSim.Grid.GridServer
68 72
69 private void Work() 73 private void Work()
70 { 74 {
71 m_log.Notice("Enter help for a list of commands\n"); 75 m_console.Notice("Enter help for a list of commands\n");
72 76
73 while (true) 77 while (true)
74 { 78 {
75 m_log.MainLogPrompt(); 79 m_console.Prompt();
76 } 80 }
77 } 81 }
78 82
79 private OpenGrid_Main() 83 private OpenGrid_Main()
80 { 84 {
81 if (!Directory.Exists(Util.logDir())) 85 m_console = new ConsoleBase("OpenGrid", this);
82 { 86 MainConsole.Instance = m_console;
83 Directory.CreateDirectory(Util.logDir());
84 }
85 m_log =
86 new LogBase((Path.Combine(Util.logDir(), "opengrid-gridserver-console.log")), "OpenGrid", this, true);
87 MainLog.Instance = m_log;
88 } 87 }
89 88
90 public void managercallback(string cmd) 89 public void managercallback(string cmd)
@@ -97,19 +96,18 @@ namespace OpenSim.Grid.GridServer
97 } 96 }
98 } 97 }
99 98
100
101 public void Startup() 99 public void Startup()
102 { 100 {
103 Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); 101 Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
104 //Yeah srsly, that's it. 102 //Yeah srsly, that's it.
105 if (setuponly) Environment.Exit(0); 103 if (setuponly) Environment.Exit(0);
106 104
107 m_log.Verbose("GRID", "Connecting to Storage Server"); 105 m_log.Info("[GRID]: Connecting to Storage Server");
108 m_gridManager = new GridManager(); 106 m_gridManager = new GridManager();
109 m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win 107 m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win
110 m_gridManager.config = Cfg; 108 m_gridManager.config = Cfg;
111 109
112 m_log.Verbose("GRID", "Starting HTTP process"); 110 m_log.Info("[GRID]: Starting HTTP process");
113 BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); 111 BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort);
114 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); 112 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback);
115 113
@@ -135,7 +133,7 @@ namespace OpenSim.Grid.GridServer
135 133
136 httpServer.Start(); 134 httpServer.Start();
137 135
138 m_log.Verbose("GRID", "Starting sim status checker"); 136 m_log.Info("[GRID]: Starting sim status checker");
139 137
140 Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates. 138 Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates.
141 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); 139 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
@@ -186,11 +184,11 @@ namespace OpenSim.Grid.GridServer
186 switch (cmd) 184 switch (cmd)
187 { 185 {
188 case "help": 186 case "help":
189 m_log.Notice("shutdown - shutdown the grid (USE CAUTION!)"); 187 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
190 break; 188 break;
191 189
192 case "shutdown": 190 case "shutdown":
193 m_log.Close(); 191 m_console.Close();
194 Environment.Exit(0); 192 Environment.Exit(0);
195 break; 193 break;
196 } 194 }