aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
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/Region/Application
parentCut down on the number of packets sent during terraforming. Terraforming shou... (diff)
downloadopensim-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 'OpenSim/Region/Application')
-rw-r--r--OpenSim/Region/Application/Application.cs11
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs207
2 files changed, 100 insertions, 118 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 4c4d315..f1db8d6 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -35,17 +35,20 @@ namespace OpenSim
35{ 35{
36 public class Application 36 public class Application
37 { 37 {
38 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
39
38 public static string iniFilePath = ""; 40 public static string iniFilePath = "";
39 41
40 //could move our main function into OpenSimMain and kill this class 42 //could move our main function into OpenSimMain and kill this class
41 [STAThread] 43 [STAThread]
42 public static void Main(string[] args) 44 public static void Main(string[] args)
43 { 45 {
46 log4net.Config.XmlConfigurator.Configure();
47
44 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); 48 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
45 49
46 Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); 50 Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
47 51
48
49 Console.Write("Performing compatibility checks... "); 52 Console.Write("Performing compatibility checks... ");
50 string supported = String.Empty; 53 string supported = String.Empty;
51 if (Util.IsEnvironmentSupported(ref supported)) 54 if (Util.IsEnvironmentSupported(ref supported))
@@ -75,11 +78,10 @@ namespace OpenSim
75 OpenSimMain sim = new OpenSimMain(configSource); 78 OpenSimMain sim = new OpenSimMain(configSource);
76 79
77 sim.StartUp(); 80 sim.StartUp();
78
79 81
80 while (true) 82 while (true)
81 { 83 {
82 MainLog.Instance.MainLogPrompt(); 84 MainConsole.Instance.Prompt();
83 } 85 }
84 } 86 }
85 87
@@ -112,7 +114,7 @@ namespace OpenSim
112 114
113 // Do we not always want to see exception messages? 115 // Do we not always want to see exception messages?
114// if (e.IsTerminating) 116// if (e.IsTerminating)
115 MainLog.Instance.Error("APPLICATION", msg); 117 MainConsole.Instance.Error("[APPLICATION]: " + msg);
116 118
117 // Try to post errormessage to an URL 119 // Try to post errormessage to an URL
118 try 120 try
@@ -131,6 +133,5 @@ namespace OpenSim
131 133
132 _IsHandlingException=false; 134 _IsHandlingException=false;
133 } 135 }
134
135 } 136 }
136} 137}
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 36de410..074a7b5 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -55,6 +55,8 @@ namespace OpenSim
55 55
56 public class OpenSimMain : RegionApplicationBase, conscmd_callback 56 public class OpenSimMain : RegionApplicationBase, conscmd_callback
57 { 57 {
58 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
59
58 private const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; 60 private const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml";
59 61
60 public string m_physicsEngine; 62 public string m_physicsEngine;
@@ -77,7 +79,6 @@ namespace OpenSim
77 79
78 private bool m_verbose; 80 private bool m_verbose;
79 private bool m_physicalPrim; 81 private bool m_physicalPrim;
80 private readonly string m_logFilename = "region-console.log";
81 private bool m_permissions = false; 82 private bool m_permissions = false;
82 83
83 private bool m_standaloneAuthenticate = false; 84 private bool m_standaloneAuthenticate = false;
@@ -146,9 +147,7 @@ namespace OpenSim
146 { 147 {
147 // no default config files, so set default values, and save it 148 // no default config files, so set default values, and save it
148 m_config.Merge(DefaultConfig()); 149 m_config.Merge(DefaultConfig());
149
150 m_config.Merge(configSource); 150 m_config.Merge(configSource);
151
152 m_config.Save(Application.iniFilePath); 151 m_config.Save(Application.iniFilePath);
153 } 152 }
154 } 153 }
@@ -233,6 +232,8 @@ namespace OpenSim
233 m_sandbox = !startupConfig.GetBoolean("gridmode", false); 232 m_sandbox = !startupConfig.GetBoolean("gridmode", false);
234 m_physicsEngine = startupConfig.GetString("physics", "basicphysics"); 233 m_physicsEngine = startupConfig.GetString("physics", "basicphysics");
235 m_meshEngineName = startupConfig.GetString("meshing", "ZeroMesher"); 234 m_meshEngineName = startupConfig.GetString("meshing", "ZeroMesher");
235
236 // TODO: since log4net changes, verbose flag doesn't do anything
236 m_verbose = startupConfig.GetBoolean("verbose", true); 237 m_verbose = startupConfig.GetBoolean("verbose", true);
237 238
238 m_physicalPrim = startupConfig.GetBoolean("physical_prim", true); 239 m_physicalPrim = startupConfig.GetBoolean("physical_prim", true);
@@ -280,7 +281,6 @@ namespace OpenSim
280 //if (!m_sandbox) 281 //if (!m_sandbox)
281 //m_SendChildAgentTaskData = false; 282 //m_SendChildAgentTaskData = false;
282 283
283
284 m_networkServersInfo.loadFromConfiguration(m_config); 284 m_networkServersInfo.loadFromConfiguration(m_config);
285 } 285 }
286 286
@@ -293,16 +293,8 @@ namespace OpenSim
293 // Called from app startup (OpenSim.Application) 293 // Called from app startup (OpenSim.Application)
294 // 294 //
295 295
296 296 m_console = CreateConsole();
297 // Create log directory if it doesn't exist 297 MainConsole.Instance = m_console;
298 if (!Directory.Exists(Util.logDir()))
299 {
300 Directory.CreateDirectory(Util.logDir());
301 }
302
303 // Create a log instance
304 m_log = CreateLog();
305 MainLog.Instance = m_log;
306 298
307 StatsManager.StartCollectingSimExtraStats(); 299 StatsManager.StartCollectingSimExtraStats();
308 300
@@ -311,7 +303,6 @@ namespace OpenSim
311 // This base will call abstract Initialize 303 // This base will call abstract Initialize
312 base.StartUp(); 304 base.StartUp();
313 305
314
315 // StandAlone mode? m_sandbox is determined by !startupConfig.GetBoolean("gridmode", false) 306 // StandAlone mode? m_sandbox is determined by !startupConfig.GetBoolean("gridmode", false)
316 if (m_sandbox) 307 if (m_sandbox)
317 { 308 {
@@ -357,10 +348,10 @@ namespace OpenSim
357 } 348 }
358 349
359 // Create a ModuleLoader instance 350 // Create a ModuleLoader instance
360 m_moduleLoader = new ModuleLoader(m_log, m_config); 351 m_moduleLoader = new ModuleLoader(m_config);
361 352
362 ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); 353 ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup");
363 m_log.Verbose("PLUGINS", "Loading {0} OpenSim application plugins", nodes.Count); 354 m_log.Info(String.Format("[PLUGINS]: Loading {0} OpenSim application plugins", nodes.Count));
364 355
365 foreach (TypeExtensionNode node in nodes) 356 foreach (TypeExtensionNode node in nodes)
366 { 357 {
@@ -383,7 +374,7 @@ namespace OpenSim
383 } 374 }
384 else 375 else
385 { 376 {
386 m_log.Verbose("STARTUP", "No startup command script specified. Moving on..."); 377 m_log.Info("[STARTUP]: No startup command script specified. Moving on...");
387 } 378 }
388 379
389 // Start timer script (run a script every xx seconds) 380 // Start timer script (run a script every xx seconds)
@@ -396,10 +387,7 @@ namespace OpenSim
396 } 387 }
397 388
398 // We are done with startup 389 // We are done with startup
399 m_log.Status("STARTUP", 390 m_log.Info("[STARTUP]: Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)");
400 "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)");
401
402 // When we return now we will be in a wait for input command loop.
403 } 391 }
404 392
405 protected override void Initialize() 393 protected override void Initialize()
@@ -433,8 +421,9 @@ namespace OpenSim
433 assetServer = sqlAssetServer; 421 assetServer = sqlAssetServer;
434 } 422 }
435 423
436 m_assetCache = new AssetCache(assetServer, m_log); 424 m_assetCache = new AssetCache(assetServer);
437 // m_assetCache = new assetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); 425 // m_assetCache = new assetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
426
438 m_sceneManager.OnRestartSim += handleRestartRegion; 427 m_sceneManager.OnRestartSim += handleRestartRegion;
439 } 428 }
440 429
@@ -448,23 +437,23 @@ namespace OpenSim
448 UDPServer udpServer; 437 UDPServer udpServer;
449 Scene scene = SetupScene(regionInfo, out udpServer, m_permissions); 438 Scene scene = SetupScene(regionInfo, out udpServer, m_permissions);
450 439
451 m_log.Verbose("MODULES", "Loading Region's modules"); 440 m_log.Info("[MODULES]: Loading Region's modules");
452 441
453 m_moduleLoader.PickupModules(scene, "."); 442 m_moduleLoader.PickupModules(scene, ".");
454 //m_moduleLoader.PickupModules(scene, "ScriptEngines"); 443 //m_moduleLoader.PickupModules(scene, "ScriptEngines");
455 //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); 444 //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene);
456 m_log.Verbose("MODULES", "Loading scripting engine modules"); 445 m_log.Info("[MODULES]: Loading scripting engine modules");
457 foreach (string module in m_scriptEngine.Split(',')) 446 foreach (string module in m_scriptEngine.Split(','))
458 { 447 {
459 string mod = module.Trim(" \t".ToCharArray()); // Clean up name 448 string mod = module.Trim(" \t".ToCharArray()); // Clean up name
460 m_log.Verbose("MODULES", "Loading scripting engine: " + mod); 449 m_log.Info("[MODULES]: Loading scripting engine: " + mod);
461 try 450 try
462 { 451 {
463 m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", mod), scene); 452 m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", mod), scene);
464 } 453 }
465 catch (Exception ex) 454 catch (Exception ex)
466 { 455 {
467 m_log.Error("MODULES", "Failed to load script engine: " + ex.ToString()); 456 m_log.Error("[MODULES]: Failed to load script engine: " + ex.ToString());
468 } 457 }
469 } 458 }
470 459
@@ -503,8 +492,7 @@ namespace OpenSim
503 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); 492 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
504 if (m_SendChildAgentTaskData) 493 if (m_SendChildAgentTaskData)
505 { 494 {
506 m_log.Error("WARNING", 495 m_log.Error("[WARNING]: Send Child Agent Task Updates is enabled. This is for testing only.");
507 "Send Child Agent Task Updates is enabled. This is for testing only.");
508 //Thread.Sleep(12000); 496 //Thread.Sleep(12000);
509 } 497 }
510 return 498 return
@@ -516,7 +504,7 @@ namespace OpenSim
516 504
517 public void handleRestartRegion(RegionInfo whichRegion) 505 public void handleRestartRegion(RegionInfo whichRegion)
518 { 506 {
519 m_log.Error("MAIN", "Got restart signal from SceneManager"); 507 m_log.Error("[MAIN]: Got restart signal from SceneManager");
520 // Shutting down the UDP server 508 // Shutting down the UDP server
521 bool foundUDPServer = false; 509 bool foundUDPServer = false;
522 int UDPServerElement = 0; 510 int UDPServerElement = 0;
@@ -557,14 +545,9 @@ namespace OpenSim
557 //m_sceneManager.SendSimOnlineNotification(restartingRegion.RegionHandle); 545 //m_sceneManager.SendSimOnlineNotification(restartingRegion.RegionHandle);
558 } 546 }
559 547
560 protected override LogBase CreateLog() 548 protected override ConsoleBase CreateConsole()
561 { 549 {
562 if (!Directory.Exists(Util.logDir())) 550 return new ConsoleBase("Region", this);
563 {
564 Directory.CreateDirectory(Util.logDir());
565 }
566
567 return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, m_verbose);
568 } 551 }
569 552
570 # region Setup methods 553 # region Setup methods
@@ -609,15 +592,15 @@ namespace OpenSim
609 RunCommandScript(m_shutdownCommandsFile); 592 RunCommandScript(m_shutdownCommandsFile);
610 } 593 }
611 594
612 m_log.Verbose("SHUTDOWN", "Closing all threads"); 595 m_log.Info("[SHUTDOWN]: Closing all threads");
613 m_log.Verbose("SHUTDOWN", "Killing listener thread"); 596 m_log.Info("[SHUTDOWN]: Killing listener thread");
614 m_log.Verbose("SHUTDOWN", "Killing clients"); 597 m_log.Info("[SHUTDOWN]: Killing clients");
615 // TODO: implement this 598 // TODO: implement this
616 m_log.Verbose("SHUTDOWN", "Closing console and terminating"); 599 m_log.Info("[SHUTDOWN]: Closing console and terminating");
617 600
618 m_sceneManager.Close(); 601 m_sceneManager.Close();
619 602
620 m_log.Close(); 603 m_console.Close();
621 Environment.Exit(0); 604 Environment.Exit(0);
622 } 605 }
623 606
@@ -637,7 +620,7 @@ namespace OpenSim
637 /// <param name="fileName"></param> 620 /// <param name="fileName"></param>
638 private void RunCommandScript(string fileName) 621 private void RunCommandScript(string fileName)
639 { 622 {
640 m_log.Verbose("COMMANDFILE", "Running " + fileName); 623 m_log.Info("[COMMANDFILE]: Running " + fileName);
641 if (File.Exists(fileName)) 624 if (File.Exists(fileName))
642 { 625 {
643 StreamReader readFile = File.OpenText(fileName); 626 StreamReader readFile = File.OpenText(fileName);
@@ -646,14 +629,14 @@ namespace OpenSim
646 { 629 {
647 if (currentCommand != String.Empty) 630 if (currentCommand != String.Empty)
648 { 631 {
649 m_log.Verbose("COMMANDFILE", "Running '" + currentCommand + "'"); 632 m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'");
650 m_log.MainLogRunCommand(currentCommand); 633 m_console.RunCommand(currentCommand);
651 } 634 }
652 } 635 }
653 } 636 }
654 else 637 else
655 { 638 {
656 m_log.Error("COMMANDFILE", "Command script missing. Can not run commands"); 639 m_log.Error("[COMMANDFILE]: Command script missing. Can not run commands");
657 } 640 }
658 } 641 }
659 642
@@ -673,7 +656,7 @@ namespace OpenSim
673 break; 656 break;
674 657
675 case "force-update": 658 case "force-update":
676 Console.WriteLine("Updating all clients"); 659 m_console.Notice("Updating all clients");
677 m_sceneManager.ForceCurrentSceneClientUpdate(); 660 m_sceneManager.ForceCurrentSceneClientUpdate();
678 break; 661 break;
679 662
@@ -692,36 +675,36 @@ namespace OpenSim
692 break; 675 break;
693 676
694 case "help": 677 case "help":
695 m_log.Notice("alert - send alert to a designated user or all users."); 678 m_console.Notice("alert - send alert to a designated user or all users.");
696 m_log.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); 679 m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
697 m_log.Notice(" alert general [Message] - send an alert to all users."); 680 m_console.Notice(" alert general [Message] - send an alert to all users.");
698 m_log.Notice("backup - trigger a simulator backup"); 681 m_console.Notice("backup - trigger a simulator backup");
699 m_log.Notice("create user - adds a new user"); 682 m_console.Notice("create user - adds a new user");
700 m_log.Notice("change-region [name] - sets the region that many of these commands affect."); 683 m_console.Notice("change-region [name] - sets the region that many of these commands affect.");
701 m_log.Notice("command-script [filename] - Execute command in a file."); 684 m_console.Notice("command-script [filename] - Execute command in a file.");
702 m_log.Notice("debug - debugging commands"); 685 m_console.Notice("debug - debugging commands");
703 m_log.Notice(" packet 0..255 - print incoming/outgoing packets (0=off)"); 686 m_console.Notice(" packet 0..255 - print incoming/outgoing packets (0=off)");
704 m_log.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); 687 m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim");
705 m_log.Notice("export-map [filename] - save image of world map"); 688 m_console.Notice("export-map [filename] - save image of world map");
706 m_log.Notice("force-update - force an update of prims in the scene"); 689 m_console.Notice("force-update - force an update of prims in the scene");
707 m_log.Notice("load-xml [filename] - load prims from XML"); 690 m_console.Notice("load-xml [filename] - load prims from XML");
708 m_log.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); 691 m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format");
709 m_log.Notice("permissions [true/false] - turn on/off permissions on the scene"); 692 m_console.Notice("permissions [true/false] - turn on/off permissions on the scene");
710 m_log.Notice("quit - equivalent to shutdown."); 693 m_console.Notice("quit - equivalent to shutdown.");
711 m_log.Notice("restart - disconnects all clients and restarts the sims in the instance."); 694 m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
712 m_log.Notice("remove-region [name] - remove a region"); 695 m_console.Notice("remove-region [name] - remove a region");
713 m_log.Notice("save-xml [filename] - save prims to XML"); 696 m_console.Notice("save-xml [filename] - save prims to XML");
714 m_log.Notice("save-xml2 [filename] - save prims to XML using version 2 format"); 697 m_console.Notice("save-xml2 [filename] - save prims to XML using version 2 format");
715 m_log.Notice("script - manually trigger scripts? or script commands?"); 698 m_console.Notice("script - manually trigger scripts? or script commands?");
716 m_log.Notice("set-time [x] - set the current scene time phase"); 699 m_console.Notice("set-time [x] - set the current scene time phase");
717 m_log.Notice("show users - show info about connected users."); 700 m_console.Notice("show users - show info about connected users.");
718 m_log.Notice("show modules - shows info aboutloaded modules."); 701 m_console.Notice("show modules - shows info aboutloaded modules.");
719 m_log.Notice("show stats - statistical information for this server not displayed in the client"); 702 m_console.Notice("show stats - statistical information for this server not displayed in the client");
720 m_log.Notice("shutdown - disconnect all clients and shutdown."); 703 m_console.Notice("shutdown - disconnect all clients and shutdown.");
721 m_log.Notice("config set section field value - set a config value"); 704 m_console.Notice("config set section field value - set a config value");
722 m_log.Notice("config get section field - get a config value"); 705 m_console.Notice("config get section field - get a config value");
723 m_log.Notice("config save - save OpenSim.ini"); 706 m_console.Notice("config save - save OpenSim.ini");
724 m_log.Notice("terrain help - show help for terrain commands."); 707 m_console.Notice("terrain help - show help for terrain commands.");
725 break; 708 break;
726 709
727 case "save-xml": 710 case "save-xml":
@@ -757,8 +740,8 @@ namespace OpenSim
757 { 740 {
758 loadOffset.Z = (float) Convert.ToDecimal(cmdparams[4]); 741 loadOffset.Z = (float) Convert.ToDecimal(cmdparams[4]);
759 } 742 }
760 m_log.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," + 743 m_console.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," +
761 loadOffset.Z + ">"); 744 loadOffset.Z + ">");
762 } 745 }
763 } 746 }
764 m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset); 747 m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset);
@@ -796,7 +779,7 @@ namespace OpenSim
796 779
797 if (!m_sceneManager.RunTerrainCmdOnCurrentScene(cmdparams, ref result)) 780 if (!m_sceneManager.RunTerrainCmdOnCurrentScene(cmdparams, ref result))
798 { 781 {
799 m_log.Error(result); 782 m_console.Error(result);
800 } 783 }
801 break; 784 break;
802 785
@@ -867,20 +850,18 @@ namespace OpenSim
867 850
868 if (!m_sceneManager.TrySetCurrentScene(regionName)) 851 if (!m_sceneManager.TrySetCurrentScene(regionName))
869 { 852 {
870 m_log.Error("Couldn't set current region to: " + regionName); 853 m_console.Error("Couldn't set current region to: " + regionName);
871 } 854 }
872 } 855 }
873 856
874 if (m_sceneManager.CurrentScene == null) 857 if (m_sceneManager.CurrentScene == null)
875 { 858 {
876 m_log.Notice("CONSOLE", 859 m_console.Error("CONSOLE", "Currently at Root level. To change region please use 'change-region <regioname>'");
877 "Currently at Root level. To change region please use 'change-region <regioname>'");
878 } 860 }
879 else 861 else
880 { 862 {
881 m_log.Notice("CONSOLE", 863 m_console.Error("CONSOLE", "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName +
882 "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + 864 ". To change region please use 'change-region <regioname>'");
883 ". To change region please use 'change-region <regioname>'");
884 } 865 }
885 866
886 break; 867 break;
@@ -905,8 +886,8 @@ namespace OpenSim
905 case "set": 886 case "set":
906 if (cmdparams.Length < 4) 887 if (cmdparams.Length < 4)
907 { 888 {
908 m_log.Notice(n, "SYNTAX: " + n + " SET SECTION KEY VALUE"); 889 m_console.Error(n, "SYNTAX: " + n + " SET SECTION KEY VALUE");
909 m_log.Notice(n, "EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); 890 m_console.Error(n, "EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5");
910 } 891 }
911 else 892 else
912 { 893 {
@@ -916,37 +897,35 @@ namespace OpenSim
916 string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3); 897 string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3);
917 c.Set(cmdparams[2], _value); 898 c.Set(cmdparams[2], _value);
918 m_config.Merge(c.ConfigSource); 899 m_config.Merge(c.ConfigSource);
919 900
920 m_log.Notice(n, 901 m_console.Error(n, n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " +
921 n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " + 902 _value);
922 _value);
923 } 903 }
924 break; 904 break;
925 case "get": 905 case "get":
926 if (cmdparams.Length < 3) 906 if (cmdparams.Length < 3)
927 { 907 {
928 m_log.Notice(n, "SYNTAX: " + n + " GET SECTION KEY"); 908 m_console.Error(n, "SYNTAX: " + n + " GET SECTION KEY");
929 m_log.Notice(n, "EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads"); 909 m_console.Error(n, "EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads");
930 } 910 }
931 else 911 else
932 { 912 {
933 IConfig c = DefaultConfig().Configs[cmdparams[1]]; 913 IConfig c = DefaultConfig().Configs[cmdparams[1]];
934 if (c == null) 914 if (c == null)
935 { 915 {
936 m_log.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist."); 916 m_console.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist.");
937 break; 917 break;
938 } 918 }
939 else 919 else
940 { 920 {
941 m_log.Notice(n, 921 m_console.Notice(n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " +
942 n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " + 922 c.GetString(cmdparams[2]));
943 c.GetString(cmdparams[2]));
944 } 923 }
945 } 924 }
946 925
947 break; 926 break;
948 case "save": 927 case "save":
949 m_log.Notice(n, "Saving configuration file: " + Application.iniFilePath); 928 m_console.Notice("Saving configuration file: " + Application.iniFilePath);
950 m_config.Save(Application.iniFilePath); 929 m_config.Save(Application.iniFilePath);
951 break; 930 break;
952 } 931 }
@@ -957,7 +936,7 @@ namespace OpenSim
957 * Temporarily disabled but it would be good to have this - needs to be levered 936 * Temporarily disabled but it would be good to have this - needs to be levered
958 * in to BaseOpenSimServer (which requires a RunCmd method restrcuture probably) 937 * in to BaseOpenSimServer (which requires a RunCmd method restrcuture probably)
959 default: 938 default:
960 m_log.Error("Unknown command"); 939 m_console.Error("Unknown command");
961 break; 940 break;
962 */ 941 */
963 } 942 }
@@ -973,18 +952,18 @@ namespace OpenSim
973 int newDebug; 952 int newDebug;
974 if (int.TryParse(args[1], out newDebug)) 953 if (int.TryParse(args[1], out newDebug))
975 { 954 {
976 m_sceneManager.SetDebugPacketOnCurrentScene(m_log, newDebug); 955 m_sceneManager.SetDebugPacketOnCurrentScene(newDebug);
977 } 956 }
978 else 957 else
979 { 958 {
980 m_log.Error("packet debug should be 0..2"); 959 m_console.Error("packet debug should be 0..2");
981 } 960 }
982 Console.WriteLine("New packet debug: " + newDebug.ToString()); 961 m_console.Notice("New packet debug: " + newDebug.ToString());
983 } 962 }
984 963
985 break; 964 break;
986 default: 965 default:
987 m_log.Error("Unknown debug"); 966 m_console.Error("Unknown debug");
988 break; 967 break;
989 } 968 }
990 } 969 }
@@ -997,7 +976,7 @@ namespace OpenSim
997 switch (ShowWhat) 976 switch (ShowWhat)
998 { 977 {
999 case "users": 978 case "users":
1000 m_log.Notice( 979 m_console.Notice(
1001 String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}", "Firstname", "Lastname", 980 String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}", "Firstname", "Lastname",
1002 "Agent ID", "Circuit", "IP", "Region")); 981 "Agent ID", "Circuit", "IP", "Region"));
1003 982
@@ -1015,6 +994,7 @@ namespace OpenSim
1015 { 994 {
1016 regionName = regionInfo.RegionName; 995 regionName = regionInfo.RegionName;
1017 } 996 }
997
1018 for (int i = 0; i < m_udpServers.Count; i++) 998 for (int i = 0; i < m_udpServers.Count; i++)
1019 { 999 {
1020 if (m_udpServers[i].RegionHandle == presence.RegionHandle) 1000 if (m_udpServers[i].RegionHandle == presence.RegionHandle)
@@ -1023,7 +1003,8 @@ namespace OpenSim
1023 m_udpServers[i].clientCircuits_reverse.TryGetValue(presence.ControllingClient.CircuitCode, out ep); 1003 m_udpServers[i].clientCircuits_reverse.TryGetValue(presence.ControllingClient.CircuitCode, out ep);
1024 } 1004 }
1025 } 1005 }
1026 m_log.Notice( 1006
1007 m_console.Notice(
1027 String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}", 1008 String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}",
1028 presence.Firstname, 1009 presence.Firstname,
1029 presence.Lastname, 1010 presence.Lastname,
@@ -1035,10 +1016,10 @@ namespace OpenSim
1035 1016
1036 break; 1017 break;
1037 case "modules": 1018 case "modules":
1038 m_log.Notice("The currently loaded shared modules are:"); 1019 m_console.Notice("The currently loaded shared modules are:");
1039 foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) 1020 foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
1040 { 1021 {
1041 m_log.Notice("Shared Module: " + module.Name); 1022 m_console.Notice("Shared Module: " + module.Name);
1042 } 1023 }
1043 break; 1024 break;
1044 1025
@@ -1046,21 +1027,21 @@ namespace OpenSim
1046 m_sceneManager.ForEachScene( 1027 m_sceneManager.ForEachScene(
1047 delegate(Scene scene) 1028 delegate(Scene scene)
1048 { 1029 {
1049 m_log.Notice("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " + 1030 m_console.Notice("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " +
1050 scene.RegionInfo.RegionLocX + " , Region YLoc: " + 1031 scene.RegionInfo.RegionLocX + " , Region YLoc: " +
1051 scene.RegionInfo.RegionLocY); 1032 scene.RegionInfo.RegionLocY);
1052 }); 1033 });
1053 break; 1034 break;
1054 1035
1055 case "stats": 1036 case "stats":
1056 if (StatsManager.SimExtraStats != null) 1037 if (StatsManager.SimExtraStats != null)
1057 { 1038 {
1058 m_log.Notice( 1039 m_console.Notice(
1059 "STATS", Environment.NewLine + StatsManager.SimExtraStats.Report()); 1040 "STATS", Environment.NewLine + StatsManager.SimExtraStats.Report());
1060 } 1041 }
1061 else 1042 else
1062 { 1043 {
1063 m_log.Notice("STATS", "Extra sim statistics collection has not been enabled"); 1044 m_console.Notice("Extra sim statistics collection has not been enabled");
1064 } 1045 }
1065 break; 1046 break;
1066 } 1047 }