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/MessagingServer/Main.cs | |
parent | Cut down on the number of packets sent during terraforming. Terraforming shou... (diff) | |
download | opensim-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 '')
-rw-r--r-- | OpenSim/Grid/MessagingServer/Main.cs | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index 3d5ceb4..c16b0f8 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs | |||
@@ -41,6 +41,8 @@ namespace OpenSim.Grid.MessagingServer | |||
41 | /// </summary> | 41 | /// </summary> |
42 | public class OpenMessage_Main : BaseOpenSimServer, conscmd_callback | 42 | public class OpenMessage_Main : BaseOpenSimServer, conscmd_callback |
43 | { | 43 | { |
44 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
44 | private MessageServerConfig Cfg; | 46 | private MessageServerConfig Cfg; |
45 | 47 | ||
46 | //public UserManager m_userManager; | 48 | //public UserManager m_userManager; |
@@ -51,7 +53,9 @@ namespace OpenSim.Grid.MessagingServer | |||
51 | [STAThread] | 53 | [STAThread] |
52 | public static void Main(string[] args) | 54 | public static void Main(string[] args) |
53 | { | 55 | { |
54 | Console.WriteLine("Launching MessagingServer..."); | 56 | log4net.Config.XmlConfigurator.Configure(); |
57 | |||
58 | m_log.Info("Launching MessagingServer..."); | ||
55 | 59 | ||
56 | OpenMessage_Main messageserver = new OpenMessage_Main(); | 60 | OpenMessage_Main messageserver = new OpenMessage_Main(); |
57 | 61 | ||
@@ -61,22 +65,17 @@ namespace OpenSim.Grid.MessagingServer | |||
61 | 65 | ||
62 | private OpenMessage_Main() | 66 | private OpenMessage_Main() |
63 | { | 67 | { |
64 | if (!Directory.Exists(Util.logDir())) | 68 | m_console = new ConsoleBase("OpenMessage", this); |
65 | { | 69 | MainConsole.Instance = m_console; |
66 | Directory.CreateDirectory(Util.logDir()); | ||
67 | } | ||
68 | m_log = | ||
69 | new LogBase((Path.Combine(Util.logDir(), "opengrid-messagingserver-console.log")), "OpenMessage", this, true); | ||
70 | MainLog.Instance = m_log; | ||
71 | } | 70 | } |
72 | 71 | ||
73 | private void Work() | 72 | private void Work() |
74 | { | 73 | { |
75 | m_log.Notice("Enter help for a list of commands\n"); | 74 | m_console.Notice("Enter help for a list of commands\n"); |
76 | 75 | ||
77 | while (true) | 76 | while (true) |
78 | { | 77 | { |
79 | m_log.MainLogPrompt(); | 78 | m_console.Prompt(); |
80 | } | 79 | } |
81 | } | 80 | } |
82 | 81 | ||
@@ -84,9 +83,7 @@ namespace OpenSim.Grid.MessagingServer | |||
84 | { | 83 | { |
85 | Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); | 84 | Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); |
86 | 85 | ||
87 | 86 | m_log.Info("[REGION]: Starting HTTP process"); | |
88 | |||
89 | MainLog.Instance.Verbose("REGION", "Starting HTTP process"); | ||
90 | BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); | 87 | BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); |
91 | 88 | ||
92 | //httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); | 89 | //httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); |
@@ -104,10 +101,9 @@ namespace OpenSim.Grid.MessagingServer | |||
104 | //new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); | 101 | //new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); |
105 | 102 | ||
106 | httpServer.Start(); | 103 | httpServer.Start(); |
107 | m_log.Status("SERVER", "Messageserver 0.4 - Startup complete"); | 104 | m_log.Info("[SERVER]: Messageserver 0.4 - Startup complete"); |
108 | } | 105 | } |
109 | 106 | ||
110 | |||
111 | public void do_create(string what) | 107 | public void do_create(string what) |
112 | { | 108 | { |
113 | switch (what) | 109 | switch (what) |
@@ -120,7 +116,7 @@ namespace OpenSim.Grid.MessagingServer | |||
120 | //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | 116 | //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); |
121 | } catch (Exception ex) | 117 | } catch (Exception ex) |
122 | { | 118 | { |
123 | m_log.Error("SERVER", "Error creating user: {0}", ex.ToString()); | 119 | m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString()); |
124 | } | 120 | } |
125 | 121 | ||
126 | try | 122 | try |
@@ -130,9 +126,9 @@ namespace OpenSim.Grid.MessagingServer | |||
130 | } | 126 | } |
131 | catch (Exception ex) | 127 | catch (Exception ex) |
132 | { | 128 | { |
133 | m_log.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); | 129 | m_console.Error("[SERVER]: Error creating inventory for user: {0}", ex.ToString()); |
134 | } | 130 | } |
135 | // m_lastCreatedUser = userID; | 131 | // m_lastCreatedUser = userID; |
136 | break; | 132 | break; |
137 | } | 133 | } |
138 | } | 134 | } |
@@ -144,11 +140,11 @@ namespace OpenSim.Grid.MessagingServer | |||
144 | switch (cmd) | 140 | switch (cmd) |
145 | { | 141 | { |
146 | case "help": | 142 | case "help": |
147 | m_log.Notice("shutdown - shutdown the message server (USE CAUTION!)"); | 143 | m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)"); |
148 | break; | 144 | break; |
149 | 145 | ||
150 | case "shutdown": | 146 | case "shutdown": |
151 | m_log.Close(); | 147 | m_console.Close(); |
152 | Environment.Exit(0); | 148 | Environment.Exit(0); |
153 | break; | 149 | break; |
154 | } | 150 | } |