diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 4c1c1d2f55..3cd918c47d 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -40,19 +40,21 @@ namespace OpenSim.ApplicationPlugins.LoadRegions [Extension("/OpenSim/Startup")] public class LoadRegionsPlugin : IApplicationPlugin { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public void Initialise(OpenSimMain openSim) { - MainLog.Instance.Notice("LOADREGIONS", "Load Regions addin being initialised"); + m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); IRegionLoader regionLoader; if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") { - MainLog.Instance.Notice("LOADREGIONS", "Loading Region Info from filesystem"); + m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem"); regionLoader = new RegionLoaderFileSystem(); } else { - MainLog.Instance.Notice("LOADREGIONSPLUGIN", "Loading Region Info from web"); + m_log.Info("[LOADREGIONSPLUGIN]: Loading Region Info from web"); regionLoader = new RegionLoaderWebServer(); } @@ -63,7 +65,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions for (int i = 0; i < regionsToLoad.Length; i++) { - MainLog.Instance.Debug("LOADREGIONS", "Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ")"); + m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ")"); openSim.CreateRegion(regionsToLoad[i]); } @@ -73,17 +75,17 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public void LoadRegionFromConfig(OpenSimMain openSim, ulong regionhandle) { - MainLog.Instance.Notice("LOADREGIONS", "Load Regions addin being initialised"); + m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); IRegionLoader regionLoader; if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") { - MainLog.Instance.Notice("LOADREGIONS", "Loading Region Info from filesystem"); + m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem"); regionLoader = new RegionLoaderFileSystem(); } else { - MainLog.Instance.Notice("LOADREGIONS", "Loading Region Info from web"); + m_log.Info("[LOADREGIONS]: Loading Region Info from web"); regionLoader = new RegionLoaderWebServer(); } @@ -93,7 +95,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions { if (regionhandle == regionsToLoad[i].RegionHandle) { - MainLog.Instance.Debug("LOADREGIONS", "Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ")"); + m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ")"); openSim.CreateRegion(regionsToLoad[i]); } } diff --git a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs index 638ed3376a..9476f172eb 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs @@ -64,4 +64,4 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("1.0.*")] [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly : AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 770abe7138..d80e478163 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -46,6 +46,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions [Extension("/OpenSim/Startup")] public class RemoteAdminPlugin : IApplicationPlugin { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private OpenSimMain m_app; private BaseHttpServer m_httpd; private string requiredPassword = String.Empty; @@ -56,7 +58,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions { if (openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) { - MainLog.Instance.Verbose("RADMIN", "Remote Admin Plugin Enabled"); + m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); requiredPassword = openSim.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", String.Empty); m_app = openSim; @@ -126,7 +128,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions else { string message = (string) requestData["message"]; - MainLog.Instance.Verbose("RADMIN", "Broadcasting: " + message); + m_log.Info("[RADMIN]: Broadcasting: " + message); responseData["accepted"] = "true"; response.Value = responseData; @@ -153,7 +155,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions { string file = (string)requestData["filename"]; LLUUID regionID = LLUUID.Parse((string)requestData["regionid"]); - MainLog.Instance.Verbose("RADMIN", "Terrain Loading: " + file); + m_log.Info("[RADMIN]: Terrain Loading: " + file); responseData["accepted"] = "true"; @@ -177,7 +179,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) { - MainLog.Instance.Verbose("RADMIN", "Received Shutdown Administrator Request"); + m_log.Info("[RADMIN]: Received Shutdown Administrator Request"); XmlRpcResponse response = new XmlRpcResponse(); Hashtable requestData = (Hashtable) request.Params[0]; Hashtable responseData = new Hashtable(); @@ -233,7 +235,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public XmlRpcResponse XmlRpcCreateRegionMethod(XmlRpcRequest request) { - MainLog.Instance.Verbose("RADMIN", "Received Create Region Administrator Request"); + m_log.Info("[RADMIN]: Received Create Region Administrator Request"); XmlRpcResponse response = new XmlRpcResponse(); Hashtable requestData = (Hashtable) request.Params[0]; Hashtable responseData = new Hashtable(); @@ -284,7 +286,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public XmlRpcResponse XmlRpcCreateUserMethod(XmlRpcRequest request) { - MainLog.Instance.Verbose("RADMIN", "Received Create User Administrator Request"); + m_log.Info("[RADMIN]: Received Create User Administrator Request"); XmlRpcResponse response = new XmlRpcResponse(); Hashtable requestData = (Hashtable) request.Params[0]; Hashtable responseData = new Hashtable(); @@ -312,14 +314,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions responseData["error"] = "Error creating user"; responseData["avatar_uuid"] = LLUUID.Zero; response.Value = responseData; - MainLog.Instance.Error("RADMIN", "Error creating user (" + tempfirstname + " " + templastname + ") :"); + m_log.Error("[RADMIN]: Error creating user (" + tempfirstname + " " + templastname + ") :"); } else { responseData["created"] = "true"; responseData["avatar_uuid"] = tempuserID; response.Value = responseData; - MainLog.Instance.Verbose("RADMIN", "User " + tempfirstname + " " + templastname + " created. Userid " + tempuserID + " assigned."); + m_log.Info("[RADMIN]: User " + tempfirstname + " " + templastname + " created. Userid " + tempuserID + " assigned."); } } catch (Exception e) diff --git a/OpenSim/Framework/AssemblyInfo.cs b/OpenSim/Framework/AssemblyInfo.cs index 1507d67c95..60c9024dfc 100644 --- a/OpenSim/Framework/AssemblyInfo.cs +++ b/OpenSim/Framework/AssemblyInfo.cs @@ -61,4 +61,4 @@ using System.Runtime.InteropServices; // [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly : AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/AssetConfig.cs b/OpenSim/Framework/AssetConfig.cs index 9989bfd64e..a83981a076 100644 --- a/OpenSim/Framework/AssetConfig.cs +++ b/OpenSim/Framework/AssetConfig.cs @@ -27,6 +27,7 @@ */ using System; +using OpenSim.Framework.Console; namespace OpenSim.Framework { diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs index 59db3d66c6..902633182d 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs @@ -44,6 +44,8 @@ namespace OpenSim.Framework.AssetLoader.Filesystem { public class AssetLoaderFileSystem : IAssetLoader { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected AssetBase CreateAsset(string assetIdStr, string name, string path, bool isImage) { AssetBase asset = new AssetBase( @@ -53,13 +55,13 @@ namespace OpenSim.Framework.AssetLoader.Filesystem if (!String.IsNullOrEmpty(path)) { - MainLog.Instance.Verbose("ASSETS", "Loading: [{0}][{1}]", name, path); + m_log.Info(String.Format("[ASSETS]: Loading: [{0}][{1}]", name, path)); LoadAsset(asset, isImage, path); } else { - MainLog.Instance.Verbose("ASSETS", "Instantiated: [{0}]", name); + m_log.Info(String.Format("[ASSETS]: Instantiated: [{0}]", name)); } return asset; @@ -106,14 +108,12 @@ namespace OpenSim.Framework.AssetLoader.Filesystem } catch (XmlException e) { - MainLog.Instance.Error("ASSETS", "Error loading {0} : {1}", assetSetPath, e); + m_log.Error(String.Format("[ASSETS]: Error loading {0} : {1}", assetSetPath, e)); } } else { - MainLog.Instance.Error( - "ASSETS", - "Asset set control file assets/AssetSets.xml does not exist! No assets loaded."); + m_log.Error("[ASSETS]: Asset set control file assets/AssetSets.xml does not exist! No assets loaded."); } assets.ForEach(action); @@ -126,7 +126,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem /// protected void LoadXmlAssetSet(string assetSetPath, List assets) { - MainLog.Instance.Verbose("ASSETS", "Loading asset set {0}", assetSetPath); + m_log.Info(String.Format("[ASSETS]: Loading asset set {0}", assetSetPath)); if (File.Exists(assetSetPath)) { @@ -152,12 +152,12 @@ namespace OpenSim.Framework.AssetLoader.Filesystem } catch (XmlException e) { - MainLog.Instance.Error("ASSETS", "Error loading {0} : {1}", assetSetPath, e); + m_log.Error(String.Format("[ASSETS]: Error loading {0} : {1}", assetSetPath, e)); } } else { - MainLog.Instance.Error("ASSETS", "Asset set file {0} does not exist!", assetSetPath); + m_log.Error(String.Format("[ASSETS]: Asset set file {0} does not exist!", assetSetPath)); } } } diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs index de7708caef..8422c17d83 100644 --- a/OpenSim/Framework/ClientManager.cs +++ b/OpenSim/Framework/ClientManager.cs @@ -36,11 +36,12 @@ namespace OpenSim.Framework public class ClientManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private Dictionary m_clients; public void ForEachClient(ForEachClientDelegate whatToDo) { - // Wasteful, I know IClientAPI[] LocalClients = new IClientAPI[0]; lock (m_clients) @@ -57,7 +58,7 @@ namespace OpenSim.Framework } catch (System.Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("CLIENT", "Unable to do ForEachClient for one of the clients" + "\n Reason: " + e.ToString()); + m_log.Warn("[CLIENT]: Unable to do ForEachClient for one of the clients" + "\n Reason: " + e.ToString()); } } } @@ -116,11 +117,9 @@ namespace OpenSim.Framework } catch (System.Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Error("CLIENT", string.Format("Unable to shutdown circuit for: {0}\n Reason: {1}", agentId, e)); + m_log.Error(string.Format("[CLIENT]: Unable to shutdown circuit for: {0}\n Reason: {1}", agentId, e)); } } - - } private uint[] GetAllCircuits(LLUUID agentId) @@ -134,7 +133,6 @@ namespace OpenSim.Framework m_clients.Values.CopyTo(LocalClients, 0); } - for (int i = 0; i < LocalClients.Length; i++ ) { if (LocalClients[i].AgentId == agentId) @@ -160,7 +158,6 @@ namespace OpenSim.Framework m_clients.Values.CopyTo(LocalClients, 0); } - for (int i = 0; i < LocalClients.Length; i++) { if (LocalClients[i].AgentId != sender.AgentId) diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index db2d2fe4c6..84713b9419 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -44,6 +44,8 @@ namespace OpenSim.Framework.Communications.Cache /// public class AssetCache : IAssetReceiver { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public Dictionary Assets; public Dictionary Textures; @@ -61,14 +63,13 @@ namespace OpenSim.Framework.Communications.Cache private readonly IAssetServer m_assetServer; private readonly Thread m_assetCacheThread; - private readonly LogBase m_log; /// /// /// - public AssetCache(IAssetServer assetServer, LogBase log) + public AssetCache(IAssetServer assetServer) { - log.Verbose("ASSETSTORAGE", "Creating Asset cache"); + m_log.Info("[ASSETSTORAGE]: Creating Asset cache"); m_assetServer = assetServer; m_assetServer.SetReceiver(this); Assets = new Dictionary(); @@ -76,8 +77,6 @@ namespace OpenSim.Framework.Communications.Cache m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); m_assetCacheThread.IsBackground = true; m_assetCacheThread.Start(); - - m_log = log; } /// @@ -94,7 +93,7 @@ namespace OpenSim.Framework.Communications.Cache } catch (Exception e) { - m_log.Error("ASSETCACHE", e.ToString()); + m_log.Error("[ASSETCACHE]: " + e.ToString()); } } } @@ -198,8 +197,8 @@ namespace OpenSim.Framework.Communications.Cache } } while (--maxPolls > 0); - MainLog.Instance.Warn( - "ASSETCACHE", "Asset {0} was not received before the retrieval timeout was reached"); + m_log.Warn( + String.Format("[ASSETCACHE]: Asset {0} was not received before the retrieval timeout was reached")); return null; } @@ -266,7 +265,7 @@ namespace OpenSim.Framework.Communications.Cache } } - m_log.Verbose("ASSETCACHE", "Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result); + m_log.Info(String.Format("[ASSETCACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result)); } public void DeleteAsset(LLUUID assetID) @@ -362,7 +361,7 @@ namespace OpenSim.Framework.Communications.Cache { //if (this.RequestedTextures.ContainsKey(assetID)) //{ - // MainLog.Instance.Warn("ASSET CACHE", "sending image not found for {0}", assetID); + // m_log.Warn(String.Format("[ASSET CACHE]: sending image not found for {0}", assetID)); // AssetRequest req = this.RequestedTextures[assetID]; // ImageNotInDatabasePacket notFound = new ImageNotInDatabasePacket(); // notFound.ImageID.ID = assetID; @@ -371,7 +370,7 @@ namespace OpenSim.Framework.Communications.Cache //} //else //{ - // MainLog.Instance.Error("ASSET CACHE", "Cound not send image not found for {0}", assetID); + // m_log.Error(String.Format("[ASSET CACHE]: Cound not send image not found for {0}", assetID)); //} } diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs index 575e80a2d4..c1cf100c67 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs @@ -35,6 +35,8 @@ namespace OpenSim.Framework.Communications.Cache { public class LocalAssetServer : AssetServerBase { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private IObjectContainer db; public LocalAssetServer() @@ -43,7 +45,7 @@ namespace OpenSim.Framework.Communications.Cache yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); - MainLog.Instance.Verbose("ASSETS", "Db4 Asset database creation"); + m_log.Info("[ASSETS]: Db4 Asset database creation"); if (!yapfile) { @@ -67,7 +69,7 @@ namespace OpenSim.Framework.Communications.Cache if (db != null) { - MainLog.Instance.Verbose("ASSETSERVER", "Closing local asset server database"); + m_log.Info("[ASSETSERVER]: Closing local asset server database"); db.Close(); } } @@ -120,7 +122,7 @@ namespace OpenSim.Framework.Communications.Cache protected virtual void SetUpAssetDatabase() { - MainLog.Instance.Verbose("LOCAL ASSET SERVER", "Setting up asset database"); + m_log.Info("[LOCAL ASSET SERVER]: Setting up asset database"); base.LoadDefaultAssets(); } diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index 09f8a0c102..1d8f6baff4 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs @@ -37,6 +37,8 @@ namespace OpenSim.Framework.Communications.Cache { public abstract class AssetServerBase : IAssetServer { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected IAssetReceiver m_receiver; protected BlockingQueue m_assetRequests; protected Thread m_localAssetServerThread; @@ -68,15 +70,15 @@ namespace OpenSim.Framework.Communications.Cache if (asset != null) { - //MainLog.Instance.Verbose( - // "ASSET", "Asset {0} received from asset server", req.AssetID); + //m_log.Info( + // String.Format("[ASSET]: Asset {0} received from asset server", req.AssetID)); m_receiver.AssetReceived(asset, req.IsTexture); } else { - MainLog.Instance.Error( - "ASSET", "Asset {0} not found by asset server", req.AssetID); + m_log.Error( + String.Format("[ASSET]: Asset {0} not found by asset server", req.AssetID)); m_receiver.AssetNotFound(req.AssetID); } @@ -84,7 +86,7 @@ namespace OpenSim.Framework.Communications.Cache public virtual void LoadDefaultAssets() { - MainLog.Instance.Verbose("ASSETSERVER", "Setting up asset database"); + m_log.Info("[ASSETSERVER]: Setting up asset database"); assetLoader.ForEachDefaultXmlAsset(StoreAsset); @@ -94,7 +96,7 @@ namespace OpenSim.Framework.Communications.Cache public AssetServerBase() { - MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system"); + m_log.Info("[ASSETSERVER]: Starting asset storage system"); m_assetRequests = new BlockingQueue(); m_localAssetServerThread = new Thread(RunRequests); @@ -114,7 +116,7 @@ namespace OpenSim.Framework.Communications.Cache } catch (Exception e) { - MainLog.Instance.Error("ASSETSERVER", e.Message); + m_log.Error("[ASSETSERVER]: " + e.Message); } } } @@ -131,7 +133,7 @@ namespace OpenSim.Framework.Communications.Cache req.IsTexture = isTexture; m_assetRequests.Enqueue(req); - MainLog.Instance.Verbose("ASSET", "Added {0} to request queue", assetID); + m_log.Info(String.Format("[ASSET]: Added {0} to request queue", assetID)); } public virtual void UpdateAsset(AssetBase asset) diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index 2f0727f26a..48d9ec82db 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs @@ -36,6 +36,8 @@ namespace OpenSim.Framework.Communications.Cache { public class GridAssetClient : AssetServerBase { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private string _assetServerUrl; public GridAssetClient(string serverUrl) @@ -50,7 +52,7 @@ namespace OpenSim.Framework.Communications.Cache Stream s = null; try { - MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", req.AssetID.ToString()); + m_log.Debug(String.Format("[ASSETCACHE]: Querying for {0}", req.AssetID.ToString())); RestClient rc = new RestClient(_assetServerUrl); rc.AddResourcePath("assets"); @@ -70,9 +72,9 @@ namespace OpenSim.Framework.Communications.Cache } catch (Exception e) { - MainLog.Instance.Error("ASSETCACHE", e.Message); - MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", req.AssetID.ToString()); - MainLog.Instance.Error("ASSETCACHE", e.StackTrace); + m_log.Error("[ASSETCACHE]: " + e.Message); + m_log.Debug(String.Format("[ASSETCACHE]: Getting asset {0}", req.AssetID.ToString())); + m_log.Error("[ASSETCACHE]: " + e.StackTrace); } return null; @@ -93,19 +95,19 @@ namespace OpenSim.Framework.Communications.Cache // XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); // xs.Serialize(s, asset); // RestClient rc = new RestClient(_assetServerUrl); - MainLog.Instance.Verbose("ASSET", "Storing asset"); + m_log.Info("[ASSET]: Storing asset"); //rc.AddResourcePath("assets"); // rc.RequestMethod = "POST"; // rc.Request(s); - //MainLog.Instance.Verbose("ASSET", "Stored {0}", rc); - MainLog.Instance.Verbose("ASSET", "Sending to " + _assetServerUrl + "/assets/"); + //m_log.Info(String.Format("[ASSET]: Stored {0}", rc)); + m_log.Info("[ASSET]: Sending to " + _assetServerUrl + "/assets/"); RestObjectPoster.BeginPostObject(_assetServerUrl + "/assets/", asset); } catch (Exception e) { - MainLog.Instance.Error("ASSETS", e.Message); + m_log.Error("[ASSETS]: " + e.Message); } } diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index ae078982f3..46767bbc52 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs @@ -26,12 +26,12 @@ * */ +using System; using System.Collections.Generic; using System.IO; using System.Xml; using libsecondlife; using Nini.Config; - using OpenSim.Framework.Console; namespace OpenSim.Framework.Communications.Cache @@ -42,6 +42,8 @@ namespace OpenSim.Framework.Communications.Cache /// public class LibraryRootFolder : InventoryFolderImpl { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); /// @@ -53,7 +55,7 @@ namespace OpenSim.Framework.Communications.Cache public LibraryRootFolder() { - MainLog.Instance.Verbose("LIBRARYINVENTORY", "Loading library inventory"); + m_log.Info("[LIBRARYINVENTORY]: Loading library inventory"); agentID = libOwner; folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); @@ -138,8 +140,8 @@ namespace OpenSim.Framework.Communications.Cache /// protected void LoadLibraries(string librariesControlPath) { - MainLog.Instance.Verbose( - "LIBRARYINVENTORY", "Loading libraries control file {0}", librariesControlPath); + m_log.Info( + String.Format("LIBRARYINVENTORY", "Loading libraries control file {0}", librariesControlPath)); LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig); } @@ -186,15 +188,15 @@ namespace OpenSim.Framework.Communications.Cache libraryFolders.Add(folderInfo.folderID, folderInfo); parentFolder.SubFolders.Add(folderInfo.folderID, folderInfo); -// MainLog.Instance.Verbose( -// "LIBRARYINVENTORY", "Adding folder {0} ({1})", folderInfo.name, folderInfo.folderID); +// m_log.Info( +// String.Format("[LIBRARYINVENTORY]: Adding folder {0} ({1})", folderInfo.name, folderInfo.folderID)); } else { - MainLog.Instance.Warn( - "LIBRARYINVENTORY", - "Couldn't add folder {0} ({1}) since parent folder with ID {2} does not exist!", - folderInfo.name, folderInfo.folderID, folderInfo.parentID); + m_log.Warn( + String.Format("[LIBRARYINVENTORY]: " + + "Couldn't add folder {0} ({1}) since parent folder with ID {2} does not exist!", + folderInfo.name, folderInfo.folderID, folderInfo.parentID)); } } @@ -227,10 +229,10 @@ namespace OpenSim.Framework.Communications.Cache } else { - MainLog.Instance.Warn( - "LIBRARYINVENTORY", - "Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!", - item.inventoryName, item.inventoryID, item.parentFolderID); + m_log.Warn( + String.Format("[LIBRARYINVENTORY]: " + + "Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!", + item.inventoryName, item.inventoryID, item.parentFolderID)); } } @@ -257,14 +259,14 @@ namespace OpenSim.Framework.Communications.Cache } catch (XmlException e) { - MainLog.Instance.Error( - "LIBRARYINVENTORY", "Error loading {0} : {1}", path, e); + m_log.Error( + String.Format("[LIBRARYINVENTORY]: Error loading {0} : {1}", path, e)); } } else { - MainLog.Instance.Error( - "LIBRARYINVENTORY", "{0} file {1} does not exist!", fileDescription, path); + m_log.Error( + String.Format("[LIBRARYINVENTORY]: {0} file {1} does not exist!", fileDescription, path)); } } diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs index 0a141c3629..d3a283ad67 100644 --- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs @@ -33,6 +33,8 @@ namespace OpenSim.Framework.Communications.Cache { public class SQLAssetServer : AssetServerBase { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public SQLAssetServer(string pluginName) { AddPlugin(pluginName); @@ -45,7 +47,7 @@ namespace OpenSim.Framework.Communications.Cache public void AddPlugin(string FileName) { - MainLog.Instance.Verbose("SQLAssetServer", "AssetStorage: Attempting to load " + FileName); + m_log.Info("[SQLAssetServer]: AssetStorage: Attempting to load " + FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName); foreach (Type pluginType in pluginAssembly.GetTypes()) @@ -61,15 +63,14 @@ namespace OpenSim.Framework.Communications.Cache m_assetProvider = plug; m_assetProvider.Initialise(); - MainLog.Instance.Verbose("AssetStorage", - "Added " + m_assetProvider.Name + " " + - m_assetProvider.Version); + m_log.Info("[AssetStorage]: " + + "Added " + m_assetProvider.Name + " " + + m_assetProvider.Version); } } } } - public override void Close() { base.Close(); @@ -98,4 +99,4 @@ namespace OpenSim.Framework.Communications.Cache m_assetProvider.CommitAssets(); } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 14670fda5c..79c0c8685b 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -25,6 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + +using System; using System.Collections.Generic; using libsecondlife; using OpenSim.Framework.Console; @@ -33,6 +35,8 @@ namespace OpenSim.Framework.Communications.Cache { public class UserProfileCacheService { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + // Fields private readonly CommunicationsManager m_parent; private readonly Dictionary m_userProfiles = new Dictionary(); @@ -69,7 +73,7 @@ namespace OpenSim.Framework.Communications.Cache } else { - MainLog.Instance.Error("USERCACHE", "User profile for user {0} not found", userID); + m_log.Error(String.Format("[USERCACHE]: User profile for user {0} not found", userID)); } } } @@ -229,28 +233,28 @@ namespace OpenSim.Framework.Communications.Cache } else { - MainLog.Instance.Error( - "INVENTORYCACHE", "Could not find root folder for user {0}", remoteClient.Name); + m_log.Error( + String.Format("[INVENTORYCACHE]: Could not find root folder for user {0}", remoteClient.Name)); return; } } else { - MainLog.Instance.Error( - "INVENTORYCACHE", - "Could not find user profile for {0} for folder {1}", - remoteClient.Name, folderID); + m_log.Error( + String.Format("[INVENTORYCACHE]: " + + "Could not find user profile for {0} for folder {1}", + remoteClient.Name, folderID)); return; } // If we've reached this point then we couldn't find the folder, even though the client thinks // it exists - MainLog.Instance.Error( - "INVENTORYCACHE", - "Could not find folder {0} for user {1}", - folderID, remoteClient.Name); + m_log.Error( + String.Format("[INVENTORYCACHE]: " + + "Could not find folder {0} for user {1}", + folderID, remoteClient.Name)); } public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID) diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index f85b4ab898..6473c26378 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -54,6 +54,8 @@ namespace OpenSim.Region.Capabilities public class Caps { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private string m_httpListenerHostName; private uint m_httpListenPort; @@ -96,7 +98,7 @@ namespace OpenSim.Region.Capabilities /// public void RegisterHandlers() { - MainLog.Instance.Verbose("CAPS", "Registering CAPS handlers"); + m_log.Info("[CAPS]: Registering CAPS handlers"); string capsBase = "/CAPS/" + m_capsObjectPath; try { @@ -115,7 +117,7 @@ namespace OpenSim.Region.Capabilities } catch (Exception e) { - MainLog.Instance.Error("CAPS", e.ToString()); + m_log.Error("[CAPS]: " + e.ToString()); } } @@ -275,7 +277,7 @@ namespace OpenSim.Region.Capabilities { try { -// MainLog.Instance.Debug("CAPS", "request: {0}, path: {1}, param: {2}", request, path, param); +// m_log.Debug(String.Format("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param)); Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request)); LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); @@ -303,16 +305,16 @@ namespace OpenSim.Region.Capabilities uploadResponse.uploader = uploaderURL; uploadResponse.state = "upload"; -// MainLog.Instance.Verbose( -// "CAPS", -// "ScriptTaskInventory response: {0}", -// LLSDHelpers.SerialiseLLSDReply(uploadResponse)); +// m_log.Info( +// String.Format("[CAPS]: " + +// "ScriptTaskInventory response: {0}", +// LLSDHelpers.SerialiseLLSDReply(uploadResponse))); return LLSDHelpers.SerialiseLLSDReply(uploadResponse); } catch (Exception e) { - MainLog.Instance.Error("CAPS", e.ToString()); + m_log.Error("[CAPS]: " + e.ToString()); } return null; @@ -349,10 +351,10 @@ namespace OpenSim.Region.Capabilities uploadResponse.uploader = uploaderURL; uploadResponse.state = "upload"; -// MainLog.Instance.Verbose( -// "CAPS", -// "NoteCardAgentInventory response: {0}", -// LLSDHelpers.SerialiseLLSDReply(uploadResponse)); +// m_log.Info( +// String.Format("[CAPS]: " + +// "NoteCardAgentInventory response: {0}", +// LLSDHelpers.SerialiseLLSDReply(uploadResponse))); return LLSDHelpers.SerialiseLLSDReply(uploadResponse); } @@ -681,10 +683,10 @@ namespace OpenSim.Region.Capabilities { try { -// MainLog.Instance.Verbose( -// "CAPS", -// "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", -// data, path, param); +// m_log.Info( +// String.Format("[CAPS]: " + +// "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", +// data, path, param)); string res = String.Empty; LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); @@ -707,13 +709,13 @@ namespace OpenSim.Region.Capabilities SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data); } -// MainLog.Instance.Verbose("CAPS", "TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); +// m_log.Info(String.Format("[CAPS]: TaskInventoryScriptUpdater.uploaderCaps res: {0}", res)); return res; } catch (Exception e) { - MainLog.Instance.Error("CAPS", e.ToString()); + m_log.Error("[CAPS]: " + e.ToString()); } // XXX Maybe this should be some meaningful error packet diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index dd7c16874d..f6cfda7c8a 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -36,6 +36,8 @@ namespace OpenSim.Framework.Communications { public class CommunicationsManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected IUserService m_userService; public IUserService UserService @@ -114,11 +116,11 @@ namespace OpenSim.Framework.Communications if (cmmdParams.Length < 2) { - firstName = MainLog.Instance.CmdPrompt("First name", "Default"); - lastName = MainLog.Instance.CmdPrompt("Last name", "User"); - password = MainLog.Instance.PasswdPrompt("Password"); - regX = Convert.ToUInt32(MainLog.Instance.CmdPrompt("Start Region X", "1000")); - regY = Convert.ToUInt32(MainLog.Instance.CmdPrompt("Start Region Y", "1000")); + firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); + lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); + password = MainConsole.Instance.PasswdPrompt("Password"); + regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", "1000")); + regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", "1000")); } else { diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index a48988d10b..897aa9a043 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -36,6 +36,8 @@ namespace OpenSim.Framework.Communications { public abstract class InventoryServiceBase : IInventoryServices { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected Dictionary m_plugins = new Dictionary(); //protected IAssetServer m_assetServer; @@ -52,7 +54,7 @@ namespace OpenSim.Framework.Communications { if (!String.IsNullOrEmpty(FileName)) { - MainLog.Instance.Verbose("AGENTINVENTORY", "Inventorystorage: Attempting to load " + FileName); + m_log.Info("[AGENTINVENTORY]: Inventorystorage: Attempting to load " + FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName); foreach (Type pluginType in pluginAssembly.GetTypes()) @@ -67,7 +69,7 @@ namespace OpenSim.Framework.Communications (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); m_plugins.Add(plug.getName(), plug); - MainLog.Instance.Verbose("AGENTINVENTORY", "Added IInventoryData Interface"); + m_log.Info("[AGENTINVENTORY]: Added IInventoryData Interface"); } } } @@ -95,9 +97,8 @@ namespace OpenSim.Framework.Communications rootFolder = plugin.Value.getUserRootFolder(userID); if (rootFolder != null) { - MainLog.Instance.Verbose( - "INVENTORY", - "Found root folder for user with ID " + userID + ". Retrieving inventory contents."); + m_log.Info( + "[INVENTORY]: Found root folder for user with ID " + userID + ". Retrieving inventory contents."); inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID); inventoryList.Insert(0, rootFolder); @@ -105,8 +106,8 @@ namespace OpenSim.Framework.Communications } } - MainLog.Instance.Warn( - "INVENTORY", "Could not find a root folder belonging to user with ID " + userID); + m_log.Warn( + "[INVENTORY]: Could not find a root folder belonging to user with ID " + userID); return inventoryList; } @@ -226,10 +227,10 @@ namespace OpenSim.Framework.Communications if (null != existingRootFolder) { - MainLog.Instance.Error( - "AGENTINVENTORY", - "Did not create a new inventory for user {0} since they already have " - + "a root inventory folder with id {1}", user, existingRootFolder); + m_log.Error( + String.Format("[AGENTINVENTORY]: " + + "Did not create a new inventory for user {0} since they already have " + + "a root inventory folder with id {1}", user, existingRootFolder)); } else { @@ -251,6 +252,7 @@ namespace OpenSim.Framework.Communications public virtual void CreateNewInventorySet(LLUUID user) { InventoryFolderBase folder = new InventoryFolderBase(); + folder.parentID = LLUUID.Zero; folder.agentID = user; folder.folderID = LLUUID.Random(); diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index 7f8658dc8d..9036884b67 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs @@ -42,6 +42,8 @@ namespace OpenSim.Framework.UserManagement /// public class LoginResponse { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private Hashtable loginFlagsHash; private Hashtable globalTexturesHash; private Hashtable loginError; @@ -362,10 +364,8 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Warn( - "CLIENT", - "LoginResponse: Error creating XML-RPC Response: " + e.Message - ); + m_log.Warn("[CLIENT]: LoginResponse: Error creating XML-RPC Response: " + e.Message); + return (GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); } } // ToXmlRpcResponse @@ -461,10 +461,8 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Warn( - "CLIENT", - "LoginResponse: Error creating XML-RPC Response: " + e.Message - ); + m_log.Warn("[CLIENT]: LoginResponse: Error creating XML-RPC Response: " + e.Message); + return GenerateFailureResponseLLSD("Internal Error", "Error generating Login Response", "false"); } } diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 865349fdb3..db86a978ca 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -44,6 +44,8 @@ namespace OpenSim.Framework.UserManagement { public class LoginService { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected string m_welcomeMessage = "Welcome to OpenSim"; protected UserManagerBase m_userManager = null; protected Mutex m_loginMutex = new Mutex(false); @@ -83,7 +85,7 @@ namespace OpenSim.Framework.UserManagement try { //CFK: CustomizeResponse contains sufficient strings to alleviate the need for this. - //CKF: MainLog.Instance.Verbose("LOGIN", "Attempting login now..."); + //CKF: m_log.Info("[LOGIN]: Attempting login now..."); XmlRpcResponse response = new XmlRpcResponse(); Hashtable requestData = (Hashtable) request.Params[0]; @@ -102,16 +104,14 @@ namespace OpenSim.Framework.UserManagement if( requestData.Contains("version")) { string clientversion = (string)requestData["version"]; - MainLog.Instance.Verbose("LOGIN","Client Version " + clientversion + " for " + firstname + " " + lastname); + m_log.Info("[LOGIN]: Client Version " + clientversion + " for " + firstname + " " + lastname); } userProfile = GetTheUser(firstname, lastname); if (userProfile == null) { - MainLog.Instance.Verbose( - "LOGIN", - "Could not find a profile for " + firstname + " " + lastname); + m_log.Info("[LOGIN]: Could not find a profile for " + firstname + " " + lastname); return logResponse.CreateLoginFailedResponse(); } @@ -213,7 +213,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("LOGIN", e.ToString()); + m_log.Info("[LOGIN]: " + e.ToString()); return logResponse.CreateDeadRegionResponse(); //return logResponse.ToXmlRpcResponse(); } @@ -225,10 +225,9 @@ namespace OpenSim.Framework.UserManagement return logResponse.ToXmlRpcResponse(); } - - catch (Exception E) + catch (Exception e) { - MainLog.Instance.Verbose("LOGIN", E.ToString()); + m_log.Info("[LOGIN]: " + e.ToString()); } //} } @@ -265,9 +264,7 @@ namespace OpenSim.Framework.UserManagement userProfile = GetTheUser(firstname, lastname); if (userProfile == null) { - MainLog.Instance.Verbose( - "LOGIN", - "Could not find a profile for " + firstname + " " + lastname); + m_log.Info("[LOGIN]: Could not find a profile for " + firstname + " " + lastname); return logResponse.CreateLoginFailedResponseLLSD(); } @@ -345,7 +342,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception ex) { - MainLog.Instance.Verbose("LOGIN", ex.ToString()); + m_log.Info("[LOGIN]: " + ex.ToString()); return logResponse.CreateDeadRegionResponseLLSD(); } @@ -359,7 +356,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception ex) { - MainLog.Instance.Verbose("LOGIN", ex.ToString()); + m_log.Info("[LOGIN]: " + ex.ToString()); return logResponse.CreateFailedResponseLLSD(); } } @@ -458,7 +455,7 @@ namespace OpenSim.Framework.UserManagement string redirectURL = "about:blank?redirect-http-hack=" + System.Web.HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + lastname + "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); - //MainLog.Instance.Verbose("WEB", "R:" + redirectURL); + //m_log.Info("[WEB]: R:" + redirectURL); returnactions["int_response_code"] = statuscode; returnactions["str_redirect_location"] = redirectURL; returnactions["str_response_string"] = "GoodLogin"; @@ -604,27 +601,22 @@ namespace OpenSim.Framework.UserManagement public virtual bool AuthenticateUser(UserProfileData profile, string password) { bool passwordSuccess = false; - MainLog.Instance.Verbose( - "LOGIN", "Authenticating {0} {1} ({2})", profile.username, profile.surname, profile.UUID); + m_log.Info( + String.Format("[LOGIN]: Authenticating {0} {1} ({2})", profile.username, profile.surname, profile.UUID)); // Web Login method seems to also occasionally send the hashed password itself - // we do this to get our hash in a form that the server password code can consume // when the web-login-form submits the password in the clear (supposed to be over SSL!) if (!password.StartsWith("$1$")) password = "$1$" + Util.Md5Hash(password); - - password = password.Remove(0, 3); //remove $1$ - - string s = Util.Md5Hash(password + ":" + profile.passwordSalt); // Testing... - //MainLog.Instance.Verbose("LOGIN", "SubHash:" + s + " userprofile:" + profile.passwordHash); - //MainLog.Instance.Verbose("LOGIN", "userprofile:" + profile.passwordHash + " SubCT:" + password); + //m_log.Info("[LOGIN]: SubHash:" + s + " userprofile:" + profile.passwordHash); + //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password); passwordSuccess = (profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) || profile.passwordHash.Equals(password,StringComparison.InvariantCultureIgnoreCase)); @@ -635,8 +627,8 @@ namespace OpenSim.Framework.UserManagement public virtual bool AuthenticateUser(UserProfileData profile, LLUUID webloginkey) { bool passwordSuccess = false; - MainLog.Instance.Verbose( - "LOGIN", "Authenticating {0} {1} ({2})", profile.username, profile.surname, profile.UUID); + m_log.Info( + String.Format("[LOGIN]: Authenticating {0} {1} ({2})", profile.username, profile.surname, profile.UUID)); // Match web login key unless it's the default weblogin key LLUUID.Zero passwordSuccess = ((profile.webLoginKey==webloginkey) && profile.webLoginKey != LLUUID.Zero); diff --git a/OpenSim/Framework/Communications/RestClient/RestClient.cs b/OpenSim/Framework/Communications/RestClient/RestClient.cs index 76bad645a8..f968c9a934 100644 --- a/OpenSim/Framework/Communications/RestClient/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient/RestClient.cs @@ -56,6 +56,8 @@ namespace OpenSim.Framework.Communications /// public class RestClient { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private string realuri; #region member variables @@ -238,7 +240,7 @@ namespace OpenSim.Framework.Communications } } realuri = sb.ToString(); - MainLog.Instance.Verbose("REST", "RestURL: {0}", realuri); + m_log.Info(String.Format("[REST]: RestURL: {0}", realuri)); return new Uri(sb.ToString()); } @@ -374,16 +376,16 @@ namespace OpenSim.Framework.Communications _asyncException = null; _request.ContentLength = src.Length; - MainLog.Instance.Verbose("REST", "Request Length {0}", _request.ContentLength); - MainLog.Instance.Verbose("REST", "Sending Web Request {0}", buildUri()); + m_log.Info(String.Format("[REST]: Request Length {0}", _request.ContentLength)); + m_log.Info(String.Format("[REST]: Sending Web Request {0}", buildUri())); src.Seek(0, SeekOrigin.Begin); - MainLog.Instance.Verbose("REST", "Seek is ok"); + m_log.Info("[REST]: Seek is ok"); Stream dst = _request.GetRequestStream(); - MainLog.Instance.Verbose("REST", "GetRequestStream is ok"); + m_log.Info("[REST]: GetRequestStream is ok"); byte[] buf = new byte[1024]; int length = src.Read(buf, 0, 1024); - MainLog.Instance.Verbose("REST", "First Read is ok"); + m_log.Info("[REST]: First Read is ok"); while (length > 0) { dst.Write(buf, 0, length); diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 3b1d83715f..edab6aee13 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -43,6 +43,8 @@ namespace OpenSim.Framework.UserManagement /// public abstract class UserManagerBase : IUserService { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public UserConfig _config; private Dictionary _plugins = new Dictionary(); @@ -54,10 +56,10 @@ namespace OpenSim.Framework.UserManagement { if (!String.IsNullOrEmpty(FileName)) { - MainLog.Instance.Verbose("USERSTORAGE", "Attempting to load " + FileName); + m_log.Info("[USERSTORAGE]: Attempting to load " + FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName); - MainLog.Instance.Verbose("USERSTORAGE", "Found " + pluginAssembly.GetTypes().Length + " interfaces."); + m_log.Info("[USERSTORAGE]: Found " + pluginAssembly.GetTypes().Length + " interfaces."); foreach (Type pluginType in pluginAssembly.GetTypes()) { if (!pluginType.IsAbstract) @@ -79,7 +81,7 @@ namespace OpenSim.Framework.UserManagement { plug.Initialise(); _plugins.Add(plug.getName(), plug); - MainLog.Instance.Verbose("USERSTORAGE", "Added IUserData Interface"); + m_log.Info("[USERSTORAGE]: Added IUserData Interface"); } #region Get UserProfile @@ -116,8 +118,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to generate AgentPickerData via " + plugin.Key + "(" + query + ")"); + m_log.Info("[USERSTORAGE]: Unable to generate AgentPickerData via " + plugin.Key + "(" + query + ")"); return new List(); } } @@ -163,8 +164,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); + m_log.Info("[USERSTORAGE]: Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -190,8 +190,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -214,8 +213,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to GetUserFriendList via " + plugin.Key + "(" + e.ToString() + ")"); + m_log.Info("[USERSTORAGE]: Unable to GetUserFriendList via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -234,8 +232,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to Store WebLoginKey via " + plugin.Key + "(" + e.ToString() + ")"); + m_log.Info("[USERSTORAGE]: Unable to Store WebLoginKey via " + plugin.Key + "(" + e.ToString() + ")"); } } } @@ -250,8 +247,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to AddNewUserFriend via " + plugin.Key + "(" + e.ToString() + ")"); + m_log.Info("[USERSTORAGE]: Unable to AddNewUserFriend via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -268,8 +264,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to RemoveUserFriend via " + plugin.Key + "(" + e.ToString() + ")"); + m_log.Info("[USERSTORAGE]: Unable to RemoveUserFriend via " + plugin.Key + "(" + e.ToString() + ")"); } } } @@ -284,8 +279,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to UpdateUserFriendPerms via " + plugin.Key + "(" + e.ToString() + ")"); + m_log.Info("[USERSTORAGE]: Unable to UpdateUserFriendPerms via " + plugin.Key + "(" + e.ToString() + ")"); } } } @@ -304,8 +298,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -337,8 +330,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -454,14 +446,14 @@ namespace OpenSim.Framework.UserManagement } else { - MainLog.Instance.Verbose("LOGOUT", "didn't save logout position, currentAgent is null *do Fix "); + m_log.Info("[LOGOUT]: didn't save logout position, currentAgent is null *do Fix "); } - MainLog.Instance.Verbose("LOGOUT", userProfile.username + " " + userProfile.surname + " from " + regionhandle + "(" + posx + "," + posy + "," + posz + ")" ); - MainLog.Instance.Verbose("LOGOUT", "userid: " + userid.ToString() + " regionid: " + regionid.ToString() ); + m_log.Info("[LOGOUT]: " + userProfile.username + " " + userProfile.surname + " from " + regionhandle + "(" + posx + "," + posy + "," + posz + ")" ); + m_log.Info("[LOGOUT]: userid: " + userid.ToString() + " regionid: " + regionid.ToString() ); } else { - MainLog.Instance.Warn("LOGOUT", "Unknown User logged out"); + m_log.Warn("[LOGOUT]: Unknown User logged out"); } } @@ -539,8 +531,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", - "Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); + m_log.Info("[USERSTORAGE]: Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); } } diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index e27c88b9d1..a657c3a66b 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs @@ -35,6 +35,8 @@ namespace OpenSim.Framework.Configuration.HTTP { public class HTTPConfiguration : IGenericConfig { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private RemoteConfigSettings remoteConfigSettings; private XmlConfiguration xmlConfig; @@ -81,7 +83,7 @@ namespace OpenSim.Framework.Configuration.HTTP } catch (WebException) { - MainLog.Instance.Warn("Unable to connect to remote configuration file (" + + m_log.Warn("Unable to connect to remote configuration file (" + remoteConfigSettings.baseConfigURL + configFileName + "). Creating local file instead."); xmlConfig.SetFileName(configFileName); diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs index 7590495c33..921fb66229 100644 --- a/OpenSim/Framework/ConfigurationMember.cs +++ b/OpenSim/Framework/ConfigurationMember.cs @@ -39,6 +39,8 @@ namespace OpenSim.Framework { public class ConfigurationMember { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); public delegate void ConfigurationOptionsLoad(); @@ -110,7 +112,7 @@ namespace OpenSim.Framework } else { - MainLog.Instance.Notice( + m_log.Info( "Required fields for adding a configuration option is invalid. Will not add this option (" + option.configurationKey + ")"); } @@ -147,46 +149,44 @@ namespace OpenSim.Framework checkAndAddConfigOption(configOption); } - // TEMP - REMOVE private int cE = 0; public void performConfigurationRetrieve() { if (cE > 1) - MainLog.Instance.Error("READING CONFIGURATION COUT: " + cE.ToString()); + m_log.Error("READING CONFIGURATION COUT: " + cE.ToString()); configurationPlugin = LoadConfigDll(configurationPluginFilename); configurationOptions.Clear(); if (loadFunction == null) { - MainLog.Instance.Error("Load Function for '" + configurationDescription + + m_log.Error("Load Function for '" + configurationDescription + "' is null. Refusing to run configuration."); return; } if (resultFunction == null) { - MainLog.Instance.Error("Result Function for '" + configurationDescription + + m_log.Error("Result Function for '" + configurationDescription + "' is null. Refusing to run configuration."); return; } - MainLog.Instance.Verbose("CONFIG", "Calling Configuration Load Function..."); + m_log.Info("[CONFIG]: Calling Configuration Load Function..."); loadFunction(); if (configurationOptions.Count <= 0) { - MainLog.Instance.Error("CONFIG", - "No configuration options were specified for '" + configurationOptions + - "'. Refusing to continue configuration."); + m_log.Error("[CONFIG]: No configuration options were specified for '" + configurationOptions + + "'. Refusing to continue configuration."); return; } bool useFile = true; if (configurationPlugin == null) { - MainLog.Instance.Error("CONFIG", "Configuration Plugin NOT LOADED!"); + m_log.Error("[CONFIG]: Configuration Plugin NOT LOADED!"); return; } @@ -200,7 +200,7 @@ namespace OpenSim.Framework } catch (XmlException e) { - MainLog.Instance.Error("Error loading " + configurationFilename + ": " + e.ToString()); + m_log.Error("Error loading " + configurationFilename + ": " + e.ToString()); useFile = false; } } @@ -208,11 +208,11 @@ namespace OpenSim.Framework { if (configurationFromXMLNode != null) { - MainLog.Instance.Notice("Loading from XML Node, will not save to the file"); + m_log.Info("Loading from XML Node, will not save to the file"); configurationPlugin.LoadDataFromString(configurationFromXMLNode.OuterXml); } - MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file."); + m_log.Info("XML Configuration Filename is not valid; will not save to the file."); useFile = false; } @@ -253,15 +253,15 @@ namespace OpenSim.Framework if (configurationDescription.Trim() != String.Empty) { console_result = - MainLog.Instance.CmdPrompt( + MainConsole.Instance.CmdPrompt( configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); } else { console_result = - MainLog.Instance.CmdPrompt(configOption.configurationQuestion, - configOption.configurationDefault); + MainConsole.Instance.CmdPrompt(configOption.configurationQuestion, + configOption.configurationDefault); } } else @@ -431,7 +431,7 @@ namespace OpenSim.Framework if (!resultFunction(configOption.configurationKey, return_result)) { - MainLog.Instance.Notice( + m_log.Info( "The handler for the last configuration option denied that input, please try again."); convertSuccess = false; ignoreNextFromConfig = true; @@ -441,20 +441,18 @@ namespace OpenSim.Framework { if (configOption.configurationUseDefaultNoPrompt) { - MainLog.Instance.Error("CONFIG", - string.Format( - "[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", - configOption.configurationKey, console_result, errorMessage, - configurationFilename)); + m_log.Error(string.Format( + "[CONFIG]: [{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", + configOption.configurationKey, console_result, errorMessage, + configurationFilename)); convertSuccess = true; } else { - MainLog.Instance.Warn("CONFIG", - string.Format( - "[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", - configOption.configurationKey, console_result, errorMessage, - configurationFilename)); + m_log.Warn(string.Format( + "[CONFIG]: [{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", + configOption.configurationKey, console_result, errorMessage, + configurationFilename)); ignoreNextFromConfig = true; } } diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs similarity index 73% rename from OpenSim/Framework/Console/LogBase.cs rename to OpenSim/Framework/Console/ConsoleBase.cs index a2c4b3a4f5..3f68e50f08 100644 --- a/OpenSim/Framework/Console/LogBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -33,61 +33,28 @@ using System.Net; namespace OpenSim.Framework.Console { - public enum LogPriority : int + public class ConsoleBase { - CRITICAL, - HIGH, - MEDIUM, - NORMAL, - LOW, - VERBOSE, - EXTRAVERBOSE - } + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public class LogBase - { private object m_syncRoot = new object(); - private StreamWriter Log; - public conscmd_callback cmdparser; - public string componentname; - private bool m_verbose; + public conscmd_callback m_cmdParser; + public string m_componentName; - public LogBase(string LogFile, string componentname, conscmd_callback cmdparser, bool verbose) + public ConsoleBase(string componentname, conscmd_callback cmdparser) { - this.componentname = componentname; - this.cmdparser = cmdparser; - m_verbose = verbose; + m_componentName = componentname; + m_cmdParser = cmdparser; + System.Console.WriteLine("Creating new local console"); - if (String.IsNullOrEmpty(LogFile)) - { - LogFile = componentname + ".log"; - } - - System.Console.WriteLine("Logs will be saved to current directory in " + LogFile); - - try - { - Log = File.AppendText(LogFile); - } - catch (Exception ex) - { - System.Console.WriteLine("Unable to open log file. Do you already have another copy of OpenSim running? Permission problem?"); - System.Console.WriteLine(ex.Message); - System.Console.WriteLine(""); - System.Console.WriteLine("Application is terminating."); - System.Console.WriteLine(""); - System.Threading.Thread.CurrentThread.Abort(); - } - Log.WriteLine("========================================================================"); - Log.WriteLine(componentname + " Started at " + DateTime.Now.ToString()); + m_log.Info("[" + m_componentName + "]: Started at " + DateTime.Now.ToString()); } public void Close() { - Log.WriteLine("Shutdown at " + DateTime.Now.ToString()); - Log.Close(); + m_log.Info("[" + m_componentName + "]: Shutdown at " + DateTime.Now.ToString()); } /// @@ -99,23 +66,22 @@ namespace OpenSim.Framework.Console /// an ansii color private ConsoleColor DeriveColor(string input) { - int colIdx = (input.ToUpper().GetHashCode()%6) + 9; + int colIdx = (input.ToUpper().GetHashCode() % 6) + 9; return (ConsoleColor) colIdx; } /// - /// Sends a warning to the current log output + /// Sends a warning to the current console output /// /// The message to send /// WriteLine-style message arguments public void Warn(string format, params object[] args) { WriteNewLine(ConsoleColor.Yellow, format, args); - return; } /// - /// Sends a warning to the current log output + /// Sends a warning to the current console output /// /// The module that sent this message /// The message to send @@ -124,22 +90,20 @@ namespace OpenSim.Framework.Console { WritePrefixLine(DeriveColor(sender), sender); WriteNewLine(ConsoleColor.Yellow, format, args); - return; } /// - /// Sends a notice to the current log output + /// Sends a notice to the current console output /// /// The message to send /// WriteLine-style message arguments public void Notice(string format, params object[] args) { WriteNewLine(ConsoleColor.White, format, args); - return; } /// - /// Sends a notice to the current log output + /// Sends a notice to the current console output /// /// The module that sent this message /// The message to send @@ -148,22 +112,20 @@ namespace OpenSim.Framework.Console { WritePrefixLine(DeriveColor(sender), sender); WriteNewLine(ConsoleColor.White, format, args); - return; } /// - /// Sends an error to the current log output + /// Sends an error to the current console output /// /// The message to send /// WriteLine-style message arguments public void Error(string format, params object[] args) { WriteNewLine(ConsoleColor.Red, format, args); - return; } /// - /// Sends an error to the current log output + /// Sends an error to the current console output /// /// The module that sent this message /// The message to send @@ -172,38 +134,20 @@ namespace OpenSim.Framework.Console { WritePrefixLine(DeriveColor(sender), sender); Error(format, args); - return; } /// - /// Sends an informational message to the current log output - /// - /// The module that sent this message - /// The message to send - /// WriteLine-style message arguments - public void Verbose(string sender, string format, params object[] args) - { - if (m_verbose) - { - WritePrefixLine(DeriveColor(sender), sender); - WriteNewLine(ConsoleColor.Gray, format, args); - return; - } - } - - /// - /// Sends a status message to the current log output + /// Sends a status message to the current console output /// /// The message to send /// WriteLine-style message arguments public void Status(string format, params object[] args) { WriteNewLine(ConsoleColor.Blue, format, args); - return; } /// - /// Sends a status message to the current log output + /// Sends a status message to the current console output /// /// The module that sent this message /// The message to send @@ -212,14 +156,12 @@ namespace OpenSim.Framework.Console { WritePrefixLine(DeriveColor(sender), sender); WriteNewLine(ConsoleColor.Blue, format, args); - return; } [Conditional("DEBUG")] public void Debug(string format, params object[] args) { WriteNewLine(ConsoleColor.Gray, format, args); - return; } [Conditional("DEBUG")] @@ -227,7 +169,6 @@ namespace OpenSim.Framework.Console { WritePrefixLine(DeriveColor(sender), sender); WriteNewLine(ConsoleColor.Gray, format, args); - return; } private void WriteNewLine(ConsoleColor color, string format, params object[] args) @@ -236,19 +177,16 @@ namespace OpenSim.Framework.Console { lock (m_syncRoot) { - string now = DateTime.Now.ToString("[MM-dd HH:mm:ss] "); - Log.Write(now); try { - Log.WriteLine(format, args); - Log.Flush(); + System.Console.WriteLine(format, args); } catch (FormatException) { System.Console.WriteLine(args); } - System.Console.Write(now); + try { if (color != ConsoleColor.White) @@ -267,13 +205,10 @@ namespace OpenSim.Framework.Console // Some older systems dont support coloured text. System.Console.WriteLine(args); } - - return; } } catch (ObjectDisposedException) { - return; } } @@ -285,10 +220,7 @@ namespace OpenSim.Framework.Console { sender = sender.ToUpper(); - Log.WriteLine("[" + sender + "] "); - - - Log.Flush(); + System.Console.WriteLine("[" + sender + "] "); System.Console.Write("["); @@ -305,37 +237,29 @@ namespace OpenSim.Framework.Console } System.Console.Write("] \t"); - - return; } } catch (ObjectDisposedException) { - return; } } - public string ReadLine() { try { - string TempStr = System.Console.ReadLine(); - Log.WriteLine(TempStr); - return TempStr; + return System.Console.ReadLine(); } catch (Exception e) { - MainLog.Instance.Error("Console", "System.Console.ReadLine exception " + e.ToString()); + m_log.Error("[Console]: System.Console.ReadLine exception " + e.ToString()); return String.Empty; } } public int Read() { - int TempInt = System.Console.Read(); - Log.Write((char) TempInt); - return TempInt; + return System.Console.Read(); } public IPAddress CmdPromptIPAddress(string prompt, string defaultvalue) @@ -345,14 +269,14 @@ namespace OpenSim.Framework.Console while (true) { - addressStr = MainLog.Instance.CmdPrompt(prompt, defaultvalue); + addressStr = CmdPrompt(prompt, defaultvalue); if (IPAddress.TryParse(addressStr, out address)) { break; } else { - MainLog.Instance.Error("Illegal address. Please re-enter."); + m_log.Error("Illegal address. Please re-enter."); } } @@ -366,7 +290,7 @@ namespace OpenSim.Framework.Console while (true) { - portStr = MainLog.Instance.CmdPrompt(prompt, defaultvalue); + portStr = CmdPrompt(prompt, defaultvalue); if (uint.TryParse(portStr, out port)) { if (port >= IPEndPoint.MinPort && port <= IPEndPoint.MaxPort) @@ -375,7 +299,7 @@ namespace OpenSim.Framework.Console } } - MainLog.Instance.Error("Illegal address. Please re-enter."); + m_log.Error("Illegal address. Please re-enter."); } return port; @@ -386,8 +310,6 @@ namespace OpenSim.Framework.Console public string PasswdPrompt(string prompt) { // FIXME: Needs to be better abstracted - Log.WriteLine(prompt); - Notice(prompt); ConsoleColor oldfg = System.Console.ForegroundColor; System.Console.ForegroundColor = System.Console.BackgroundColor; string temp = System.Console.ReadLine(); @@ -398,7 +320,7 @@ namespace OpenSim.Framework.Console // Displays a command prompt and waits for the user to enter a string, then returns that string public string CmdPrompt(string prompt) { - Notice(String.Format("{0}: ", prompt)); + System.Console.WriteLine(String.Format("{0}: ", prompt)); return ReadLine(); } @@ -429,7 +351,7 @@ namespace OpenSim.Framework.Console } else { - Notice("Valid options are " + OptionA + " or " + OptionB); + System.Console.WriteLine("Valid options are " + OptionA + " or " + OptionB); temp = CmdPrompt(prompt, defaultresponse); } } @@ -439,23 +361,23 @@ namespace OpenSim.Framework.Console // Runs a command with a number of parameters public Object RunCmd(string Cmd, string[] cmdparams) { - cmdparser.RunCmd(Cmd, cmdparams); + m_cmdParser.RunCmd(Cmd, cmdparams); return null; } // Shows data about something public void ShowCommands(string ShowWhat) { - cmdparser.Show(ShowWhat); + m_cmdParser.Show(ShowWhat); } - public void MainLogPrompt() + public void Prompt() { - string tempstr = CmdPrompt(componentname + "# "); - MainLogRunCommand(tempstr); + string tempstr = CmdPrompt(m_componentName + "# "); + RunCommand(tempstr); } - public void MainLogRunCommand(string command) + public void RunCommand(string command) { string[] tempstrarray; tempstrarray = command.Split(' '); @@ -470,7 +392,7 @@ namespace OpenSim.Framework.Console } catch (Exception e) { - MainLog.Instance.Error("Console", "Command failed with exception " + e.ToString()); + m_log.Error("[Console]: Command failed with exception " + e.ToString()); } } diff --git a/OpenSim/Framework/Console/MainLog.cs b/OpenSim/Framework/Console/MainConsole.cs similarity index 93% rename from OpenSim/Framework/Console/MainLog.cs rename to OpenSim/Framework/Console/MainConsole.cs index bea2a2290f..fb88d04c00 100644 --- a/OpenSim/Framework/Console/MainLog.cs +++ b/OpenSim/Framework/Console/MainConsole.cs @@ -25,13 +25,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + namespace OpenSim.Framework.Console { - public class MainLog + public class MainConsole { - private static LogBase instance; + private static ConsoleBase instance; - public static LogBase Instance + public static ConsoleBase Instance { get { return instance; } set { instance = value; } diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index 6059cbea76..35a363587a 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs @@ -37,6 +37,8 @@ namespace OpenSim.Framework.Data.DB4o /// public class DB4oUserData : IUserData { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// The database manager /// @@ -143,22 +145,22 @@ namespace OpenSim.Framework.Data.DB4o public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) { - //MainLog.Instance.Verbose("FRIEND", "Stub AddNewUserFriend called"); + //m_log.Info("[FRIEND]: Stub AddNewUserFriend called"); } public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) { - //MainLog.Instance.Verbose("FRIEND", "Stub RemoveUserFriend called"); + //m_log.Info("[FRIEND]: Stub RemoveUserFriend called"); } public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) { - //MainLog.Instance.Verbose("FRIEND", "Stub UpdateUserFriendPerms called"); + //m_log.Info("[FRIEND]: Stub UpdateUserFriendPerms called"); } public List GetUserFriendList(LLUUID friendlistowner) { - //MainLog.Instance.Verbose("FRIEND", "Stub GetUserFriendList called"); + //m_log.Info("[FRIEND]: Stub GetUserFriendList called"); return new List(); } @@ -166,7 +168,7 @@ namespace OpenSim.Framework.Data.DB4o public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) { - //MainLog.Instance.Verbose("USER", "Stub UpdateUserCUrrentRegion called"); + //m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); } diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs index 08fbef07dd..4d5e4c7bb4 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs @@ -37,6 +37,8 @@ namespace OpenSim.Framework.Data.MSSQL { internal class MSSQLAssetData : IAssetProvider { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private MSSQLManager database; #region IAssetProvider Members @@ -46,7 +48,7 @@ namespace OpenSim.Framework.Data.MSSQL // null as the version, indicates that the table didn't exist if (tableName == null) { - MainLog.Instance.Notice("ASSETS", "Creating new database tables"); + m_log.Info("[ASSETS]: Creating new database tables"); database.ExecuteResourceSql("CreateAssetsTable.sql"); return; } @@ -164,7 +166,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs index 7d228e6bda..28eec3e179 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs @@ -40,6 +40,8 @@ namespace OpenSim.Framework.Data.MSSQL /// public class SqlGridData : IGridData { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// Database manager /// @@ -172,7 +174,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return returnlist; } } @@ -208,7 +210,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return returnlist; } } diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs index 2e5d67977c..d79d369f6c 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs @@ -39,6 +39,8 @@ namespace OpenSim.Framework.Data.MSSQL /// public class MSSQLInventoryData : IInventoryData { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// The database manager /// @@ -159,7 +161,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -198,7 +200,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -244,7 +246,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -282,7 +284,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -315,7 +317,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (SqlException e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } return null; @@ -352,7 +354,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } return null; } @@ -377,7 +379,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } return null; @@ -412,7 +414,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -452,7 +454,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (SqlException e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -511,7 +513,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -533,7 +535,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (SqlException e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -564,7 +566,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -602,7 +604,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -628,7 +630,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -675,7 +677,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (SqlException e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -695,7 +697,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (SqlException e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs index 3a70909602..e54cde1383 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs @@ -42,6 +42,8 @@ namespace OpenSim.Framework.Data.MSSQL /// internal class MSSQLManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// The database connection object /// @@ -92,7 +94,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception) { - MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating"); + m_log.Info("[DATASTORE]: MSSQL Database doesn't exist... creating"); InitDB(conn); } cmd = Query("select top 1 webLoginKey from users", new Dictionary()); @@ -260,7 +262,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error("Unable to reconnect to database " + e.ToString()); + m_log.Error("Unable to reconnect to database " + e.ToString()); } } } @@ -529,7 +531,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error("MSSQLManager : " + e.ToString()); + m_log.Error("MSSQLManager : " + e.ToString()); } return returnval; @@ -573,7 +575,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return false; } @@ -667,7 +669,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return false; } @@ -688,7 +690,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error("Unable to execute query " + e.ToString()); + m_log.Error("Unable to execute query " + e.ToString()); } } @@ -721,7 +723,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } tables.Close(); diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs index aa0526c27d..ed9929cd90 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs @@ -39,6 +39,8 @@ namespace OpenSim.Framework.Data.MSSQL /// internal class MSSQLUserData : IUserData { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// Database manager for MySQL /// @@ -94,7 +96,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -103,22 +105,22 @@ namespace OpenSim.Framework.Data.MSSQL public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) { - MainLog.Instance.Verbose("FRIEND", "Stub AddNewUserFriend called"); + m_log.Info("[FRIEND]: Stub AddNewUserFriend called"); } public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) { - MainLog.Instance.Verbose("FRIEND", "Stub RemoveUserFriend called"); + m_log.Info("[FRIEND]: Stub RemoveUserFriend called"); } public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) { - MainLog.Instance.Verbose("FRIEND", "Stub UpdateUserFriendPerms called"); + m_log.Info("[FRIEND]: Stub UpdateUserFriendPerms called"); } public List GetUserFriendList(LLUUID friendlistowner) { - MainLog.Instance.Verbose("FRIEND", "Stub GetUserFriendList called"); + m_log.Info("[FRIEND]: Stub GetUserFriendList called"); return new List(); } @@ -126,7 +128,7 @@ namespace OpenSim.Framework.Data.MSSQL public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) { - MainLog.Instance.Verbose("USER", "Stub UpdateUserCUrrentRegion called"); + m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); } @@ -168,7 +170,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return returnlist; } } @@ -204,7 +206,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return returnlist; } } @@ -235,7 +237,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -290,7 +292,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -324,7 +326,7 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -426,7 +428,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } return false; } diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs index 407d6d209e..f9ef6999d8 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs @@ -37,6 +37,8 @@ namespace OpenSim.Framework.Data.MySQL { internal class MySQLAssetData : IAssetProvider { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private MySQLManager _dbConnection; #region IAssetProvider Members @@ -46,7 +48,7 @@ namespace OpenSim.Framework.Data.MySQL // null as the version, indicates that the table didn't exist if (oldVersion == null) { - MainLog.Instance.Notice("ASSETS", "Creating new database tables"); + m_log.Info("[ASSETS]: Creating new database tables"); _dbConnection.ExecuteResourceSql("CreateAssetsTable.sql"); return; } @@ -98,9 +100,9 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error( - "ASSETS", "MySql failure fetching asset {0}" + Environment.NewLine + e.ToString() - + Environment.NewLine + "Attempting reconnection", assetID); + m_log.Error(String.Format( + "[ASSETS]: MySql failure fetching asset {0}" + Environment.NewLine + e.ToString() + + Environment.NewLine + "Attempting reconnection", assetID)); _dbConnection.Reconnect(); } } @@ -137,10 +139,10 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error( - "ASSETS", - "MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString() - + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); + m_log.Error(String.Format( + "[ASSETS]: " + + "MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString() + + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name)); _dbConnection.Reconnect(); } } diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index 54f39bbba7..e2ea018a80 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs @@ -42,6 +42,8 @@ namespace OpenSim.Framework.Data.MySQL { public class MySQLDataStore : IRegionDataStore { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private const string m_primSelect = "select * from prims"; private const string m_shapeSelect = "select * from primshapes"; private const string m_itemsSelect = "select * from primitems"; @@ -80,7 +82,7 @@ namespace OpenSim.Framework.Data.MySQL m_dataSet = new DataSet(); this.persistPrimInventories = persistPrimInventories; - MainLog.Instance.Verbose("DATASTORE", "MySql - connecting: " + connectionstring); + m_log.Info("[DATASTORE]: MySql - connecting: " + connectionstring); m_connection = new MySqlConnection(connectionstring); MySqlCommand primSelectCmd = new MySqlCommand(m_primSelect, m_connection); @@ -148,12 +150,12 @@ namespace OpenSim.Framework.Data.MySQL { if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) { - MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); + m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); addPrim(prim, obj.UUID, regionUUID); } else { - // MainLog.Instance.Verbose("DATASTORE", "Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); + // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); } } } @@ -163,7 +165,7 @@ namespace OpenSim.Framework.Data.MySQL public void RemoveObject(LLUUID obj, LLUUID regionUUID) { - MainLog.Instance.Verbose("DATASTORE", "Removing obj: {0} from region: {1}", obj.UUID, regionUUID); + m_log.Info(String.Format("[DATASTORE]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID)); DataTable prims = m_primTable; DataTable shapes = m_shapeTable; @@ -228,7 +230,7 @@ namespace OpenSim.Framework.Data.MySQL lock (m_dataSet) { DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); - MainLog.Instance.Verbose("DATASTORE", + m_log.Info("[DATASTORE]: " + "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); foreach (DataRow primRow in primsForRegion) @@ -251,7 +253,7 @@ namespace OpenSim.Framework.Data.MySQL } else { - MainLog.Instance.Notice( + m_log.Info( "No shape found for prim in storage, so setting default box shape"); prim.Shape = PrimitiveBaseShape.Default; } @@ -270,7 +272,7 @@ namespace OpenSim.Framework.Data.MySQL } else { - MainLog.Instance.Notice( + m_log.Info( "No shape found for prim in storage, so setting default box shape"); prim.Shape = PrimitiveBaseShape.Default; } @@ -284,11 +286,11 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error("DATASTORE", "Failed create prim object, exception and data follows"); - MainLog.Instance.Verbose("DATASTORE", e.ToString()); + m_log.Error("[DATASTORE]: Failed create prim object, exception and data follows"); + m_log.Info("[DATASTORE]: " + e.ToString()); foreach (DataColumn col in prims.Columns) { - MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]); + m_log.Info("[DATASTORE]: Col: " + col.ColumnName + " => " + primRow[col]); } } } @@ -302,7 +304,7 @@ namespace OpenSim.Framework.Data.MySQL /// private void LoadItems(SceneObjectPart prim) { - //MainLog.Instance.Verbose("DATASTORE", "Loading inventory for {0}, {1}", prim.Name, prim.UUID); + //m_log.Info(String.Format("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID)); DataTable dbItems = m_itemsTable; @@ -316,7 +318,7 @@ namespace OpenSim.Framework.Data.MySQL TaskInventoryItem item = buildItem(row); inventory.Add(item); - MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.Name, item.ItemID); + m_log.Info(String.Format("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID)); } prim.RestoreInventoryItems(inventory); @@ -332,7 +334,7 @@ namespace OpenSim.Framework.Data.MySQL public void StoreTerrain(double[,] ter, LLUUID regionID) { int revision = Util.UnixTimeSinceEpoch(); - MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); + m_log.Info("[DATASTORE]: Storing terrain revision r" + revision.ToString()); DataTable terrain = m_dataSet.Tables["terrain"]; lock (m_dataSet) @@ -384,11 +386,11 @@ namespace OpenSim.Framework.Data.MySQL } else { - MainLog.Instance.Verbose("DATASTORE", "No terrain found for region"); + m_log.Info("[DATASTORE]: No terrain found for region"); return null; } - MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); + m_log.Info("[DATASTORE]: Loaded terrain revision r" + rev.ToString()); } return terret; @@ -418,7 +420,7 @@ namespace OpenSim.Framework.Data.MySQL public void StoreLandObject(Land parcel, LLUUID regionUUID) { // Does the new locking fix it? - MainLog.Instance.Verbose("DATASTORE", "Tedds temp fix: Waiting 3 seconds for stuff to catch up. (Someone please fix! :))"); + m_log.Info("[DATASTORE]: Tedds temp fix: Waiting 3 seconds for stuff to catch up. (Someone please fix! :))"); System.Threading.Thread.Sleep(2500 + rnd.Next(300, 900)); lock (m_dataSet) @@ -1214,7 +1216,7 @@ namespace OpenSim.Framework.Data.MySQL if (!persistPrimInventories) return; - MainLog.Instance.Verbose("DATASTORE", "Persisting Prim Inventory with prim ID {0}", primID); + m_log.Info(String.Format("[DATASTORE]: Persisting Prim Inventory with prim ID {0}", primID)); // For now, we're just going to crudely remove all the previous inventory items // no matter whether they have changed or not, and replace them with the current set. @@ -1225,10 +1227,10 @@ namespace OpenSim.Framework.Data.MySQL // repalce with current inventory details foreach (TaskInventoryItem newItem in items) { -// MainLog.Instance.Verbose( -// "DATASTORE", -// "Adding item {0}, {1} to prim ID {2}", -// newItem.Name, newItem.ItemID, newItem.ParentPartID); +// m_log.Info(String.Format( +// "[DATASTORE]: " + +// "Adding item {0}, {1} to prim ID {2}", +// newItem.Name, newItem.ItemID, newItem.ParentPartID)); DataRow newItemRow = m_itemsTable.NewRow(); fillItemRow(newItemRow, newItem); @@ -1332,7 +1334,7 @@ namespace OpenSim.Framework.Data.MySQL sql += subsql; sql += ")"; - //MainLog.Instance.Verbose("DATASTORE", "defineTable() sql {0}", sql); + //m_log.Info(String.Format("[DATASTORE]: defineTable() sql {0}", sql)); return sql; } @@ -1463,8 +1465,8 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception ex) { - MainLog.Instance.Error("MySql", "Error connecting to MySQL server: " + ex.Message); - MainLog.Instance.Error("MySql", "Application is terminating!"); + m_log.Error("[MySql]: Error connecting to MySQL server: " + ex.Message); + m_log.Error("[MySql]: Application is terminating!"); System.Threading.Thread.CurrentThread.Abort(); } } @@ -1475,7 +1477,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (MySqlException e) { - MainLog.Instance.Warn("MySql", "Primitives Table Already Exists: {0}", e); + m_log.Warn(String.Format("[MySql]: Primitives Table Already Exists: {0}", e)); } try @@ -1484,7 +1486,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (MySqlException e) { - MainLog.Instance.Warn("MySql", "Shapes Table Already Exists: {0}", e); + m_log.Warn(String.Format("[MySql]: Shapes Table Already Exists: {0}", e)); } try @@ -1493,7 +1495,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (MySqlException e) { - MainLog.Instance.Warn("MySql", "Items Table Already Exists: {0}", e); + m_log.Warn(String.Format("[MySql]: Items Table Already Exists: {0}", e)); } try @@ -1502,7 +1504,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (MySqlException e) { - MainLog.Instance.Warn("MySql", "Terrain Table Already Exists: {0}", e); + m_log.Warn(String.Format("[MySql]: Terrain Table Already Exists: {0}", e)); } try @@ -1511,7 +1513,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (MySqlException e) { - MainLog.Instance.Warn("MySql", "Land Table Already Exists: {0}", e); + m_log.Warn(String.Format("[MySql]: Land Table Already Exists: {0}", e)); } try @@ -1520,7 +1522,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (MySqlException e) { - MainLog.Instance.Warn("MySql", "LandAccessList Table Already Exists: {0}", e); + m_log.Warn(String.Format("[MySql]: LandAccessList Table Already Exists: {0}", e)); } conn.Close(); } @@ -1555,7 +1557,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (MySqlException) { - MainLog.Instance.Verbose("DATASTORE", "MySql Database doesn't exist... creating"); + m_log.Info("[DATASTORE]: MySql Database doesn't exist... creating"); InitDB(conn); } @@ -1573,7 +1575,7 @@ namespace OpenSim.Framework.Data.MySQL { if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); return false; } } @@ -1582,7 +1584,7 @@ namespace OpenSim.Framework.Data.MySQL { if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); return false; } } @@ -1593,7 +1595,7 @@ namespace OpenSim.Framework.Data.MySQL { if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); return false; } } @@ -1602,7 +1604,7 @@ namespace OpenSim.Framework.Data.MySQL { if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); return false; } } @@ -1611,7 +1613,7 @@ namespace OpenSim.Framework.Data.MySQL { if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); return false; } } diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index c8c4ab0094..d62c286803 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs @@ -42,6 +42,8 @@ namespace OpenSim.Framework.Data.MySQL /// public class MySQLGridData : IGridData { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// MySQL Database Manager /// @@ -168,7 +170,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -200,7 +202,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -247,7 +249,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return returnlist; } } @@ -282,7 +284,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return returnlist; } } @@ -316,7 +318,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -405,7 +407,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index c317f4aa9e..57c2c9f3c8 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs @@ -38,6 +38,8 @@ namespace OpenSim.Framework.Data.MySQL /// public class MySQLInventoryData : IInventoryData { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// The database manager /// @@ -104,8 +106,8 @@ namespace OpenSim.Framework.Data.MySQL tableList["inventoryitems"] = null; database.GetTableVersion(tableList); - MainLog.Instance.Verbose("MYSQL", "Inventory Folder Version: " + tableList["inventoryfolders"]); - MainLog.Instance.Verbose("MYSQL", "Inventory Items Version: " + tableList["inventoryitems"]); + m_log.Info("[MYSQL]: Inventory Folder Version: " + tableList["inventoryfolders"]); + m_log.Info("[MYSQL]: Inventory Items Version: " + tableList["inventoryitems"]); UpgradeFoldersTable(tableList["inventoryfolders"]); UpgradeItemsTable(tableList["inventoryitems"]); @@ -170,7 +172,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -208,7 +210,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -254,7 +256,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -292,7 +294,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -325,7 +327,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (MySqlException e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } return null; @@ -362,7 +364,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } return null; } @@ -387,7 +389,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } return null; @@ -421,7 +423,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -459,7 +461,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (MySqlException e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -488,7 +490,7 @@ namespace OpenSim.Framework.Data.MySQL catch (MySqlException e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -516,7 +518,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -548,7 +550,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -593,7 +595,7 @@ namespace OpenSim.Framework.Data.MySQL catch (MySqlException e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } @@ -609,7 +611,7 @@ namespace OpenSim.Framework.Data.MySQL catch (MySqlException e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs index 3df02427ee..f70b505eef 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs @@ -42,6 +42,8 @@ namespace OpenSim.Framework.Data.MySQL /// internal class MySQLManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// The database connection object /// @@ -71,7 +73,7 @@ namespace OpenSim.Framework.Data.MySQL dbcon.Open(); - MainLog.Instance.Verbose("MYSQL", "Connection established"); + m_log.Info("[MYSQL]: Connection established"); } catch (Exception e) { @@ -113,7 +115,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error("Unable to reconnect to database " + e.ToString()); + m_log.Error("Unable to reconnect to database " + e.ToString()); } } } @@ -194,7 +196,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } tables.Close(); @@ -245,7 +247,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error("Unable to reconnect to database " + e.ToString()); + m_log.Error("Unable to reconnect to database " + e.ToString()); } // Run the query again @@ -263,7 +265,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { // Return null if it fails. - MainLog.Instance.Error("Failed during Query generation: " + e.ToString()); + m_log.Error("Failed during Query generation: " + e.ToString()); return null; } } @@ -523,7 +525,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return false; } @@ -617,7 +619,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return false; } @@ -726,7 +728,7 @@ namespace OpenSim.Framework.Data.MySQL } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return false; } diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index 2ee20e08ef..0db727c647 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs @@ -39,6 +39,8 @@ namespace OpenSim.Framework.Data.MySQL /// internal class MySQLUserData : IUserData { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// Database manager for MySQL /// @@ -119,7 +121,7 @@ namespace OpenSim.Framework.Data.MySQL database.ExecuteResourceSql("UpgradeUsersTableToVersion2.sql"); return; } - //MainLog.Instance.Verbose("DB","DBVers:" + oldVersion); + //m_log.Info("[DB]: DBVers:" + oldVersion); } /// @@ -164,7 +166,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -208,7 +210,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return; } } @@ -243,7 +245,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return; } } @@ -272,7 +274,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return; } } @@ -317,7 +319,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return Lfli; } @@ -328,7 +330,7 @@ namespace OpenSim.Framework.Data.MySQL public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) { - MainLog.Instance.Verbose("USER", "Stub UpdateUserCUrrentRegion called"); + m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); } @@ -371,7 +373,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return returnlist; } } @@ -406,7 +408,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return returnlist; } } @@ -437,7 +439,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -488,7 +490,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return; } @@ -525,7 +527,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); return null; } } @@ -553,7 +555,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception e) { database.Reconnect(); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } } diff --git a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs index 76608c785d..d08ef8bc11 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs @@ -39,6 +39,8 @@ namespace OpenSim.Framework.Data.SQLite /// public class SQLiteAssetData : SQLiteBase, IAssetProvider { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// The database manager /// @@ -86,10 +88,10 @@ namespace OpenSim.Framework.Data.SQLite public void CreateAsset(AssetBase asset) { - MainLog.Instance.Verbose("SQLITE", "Creating Asset " + Util.ToRawUuidString(asset.FullID)); + m_log.Info("[SQLITE]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); if (ExistsAsset(asset.FullID)) { - MainLog.Instance.Verbose("SQLITE", "Asset exists, updating instead. You should fix the caller for this!"); + m_log.Info("[SQLITE]: Asset exists, updating instead. You should fix the caller for this!"); UpdateAsset(asset); } else @@ -135,7 +137,7 @@ namespace OpenSim.Framework.Data.SQLite string temporary = asset.Temporary ? "Temporary" : "Stored"; string local = asset.Local ? "Local" : "Remote"; - MainLog.Instance.Verbose("SQLITE", + m_log.Info("[SQLITE]: " + string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)", asset.FullID, asset.Name, asset.Description, asset.Type, asset.InvType, temporary, local, asset.Data.Length)); @@ -174,7 +176,7 @@ namespace OpenSim.Framework.Data.SQLite public void CommitAssets() // force a sync to the database { - MainLog.Instance.Verbose("SQLITE", "Attempting commit"); + m_log.Info("[SQLITE]: Attempting commit"); // lock (ds) // { // da.Update(ds, "assets"); @@ -261,7 +263,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Verbose("SQLITE", "SQLite Database doesn't exist... creating"); + m_log.Info("[SQLITE]: SQLite Database doesn't exist... creating"); InitDB(conn); } return true; diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs index 64a27f0e68..5e5d1e480f 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs @@ -38,6 +38,8 @@ namespace OpenSim.Framework.Data.SQLite { public class SQLiteInventoryStore : SQLiteBase, IInventoryData { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private const string invItemsSelect = "select * from inventoryitems"; private const string invFoldersSelect = "select * from inventoryfolders"; @@ -57,7 +59,7 @@ namespace OpenSim.Framework.Data.SQLite { string connectionString = "URI=file:" + dbfile + ",version=3"; - MainLog.Instance.Verbose("Inventory", "Sqlite - connecting: " + dbfile); + m_log.Info("[Inventory]: Sqlite - connecting: " + dbfile); SqliteConnection conn = new SqliteConnection(connectionString); TestTables(conn); @@ -74,12 +76,12 @@ namespace OpenSim.Framework.Data.SQLite ds.Tables.Add(createInventoryFoldersTable()); invFoldersDa.Fill(ds.Tables["inventoryfolders"]); setupFoldersCommands(invFoldersDa, conn); - MainLog.Instance.Verbose("DATASTORE", "Populated Intentory Folders Definitions"); + m_log.Info("[DATASTORE]: Populated Intentory Folders Definitions"); ds.Tables.Add(createInventoryItemsTable()); invItemsDa.Fill(ds.Tables["inventoryitems"]); setupItemsCommands(invItemsDa, conn); - MainLog.Instance.Verbose("DATASTORE", "Populated Intentory Items Definitions"); + m_log.Info("[DATASTORE]: Populated Intentory Items Definitions"); ds.AcceptChanges(); } @@ -603,7 +605,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); + m_log.Info("[DATASTORE]: SQLite Database doesn't exist... creating"); InitDB(conn); } @@ -614,7 +616,7 @@ namespace OpenSim.Framework.Data.SQLite { if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); return false; } } @@ -622,7 +624,7 @@ namespace OpenSim.Framework.Data.SQLite { if (! tmpDS.Tables["inventoryfolders"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); return false; } } diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs index a97b14619c..c77a8f601b 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs @@ -37,6 +37,8 @@ namespace OpenSim.Framework.Data.SQLite { internal class SQLiteManager : SQLiteBase { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private IDbConnection dbcon; /// @@ -101,7 +103,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); + m_log.Info("[DATASTORE]: SQLite Database doesn't exist... creating"); InitDB(conn); } return true; diff --git a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs index 0afc0ced58..69dc3f5191 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs @@ -42,6 +42,8 @@ namespace OpenSim.Framework.Data.SQLite { public class SQLiteRegionData : IRegionDataStore { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private const string primSelect = "select * from prims"; private const string shapeSelect = "select * from primshapes"; private const string itemsSelect = "select * from primitems"; @@ -78,7 +80,7 @@ namespace OpenSim.Framework.Data.SQLite ds = new DataSet(); - MainLog.Instance.Verbose("DATASTORE", "Sqlite - connecting: " + connectionString); + m_log.Info("[DATASTORE]: Sqlite - connecting: " + connectionString); m_conn = new SqliteConnection(m_connectionString); m_conn.Open(); @@ -142,7 +144,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (Exception) { - MainLog.Instance.Verbose("DATASTORE", "Caught fill error on primshapes table"); + m_log.Info("[DATASTORE]: Caught fill error on primshapes table"); } try @@ -151,7 +153,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (Exception) { - MainLog.Instance.Verbose("DATASTORE", "Caught fill error on terrain table"); + m_log.Info("[DATASTORE]: Caught fill error on terrain table"); } try @@ -160,7 +162,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (Exception) { - MainLog.Instance.Verbose("DATASTORE", "Caught fill error on land table"); + m_log.Info("[DATASTORE]: Caught fill error on land table"); } try @@ -169,7 +171,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (Exception) { - MainLog.Instance.Verbose("DATASTORE", "Caught fill error on landaccesslist table"); + m_log.Info("[DATASTORE]: Caught fill error on landaccesslist table"); } return; } @@ -183,29 +185,29 @@ namespace OpenSim.Framework.Data.SQLite { if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) { - MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); + m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); } else if (prim.Stopped) { - //MainLog.Instance.Verbose("DATASTORE", + //m_log.Info("[DATASTORE]: " + //"Adding stopped obj: " + obj.UUID + " to region: " + regionUUID); //addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); } else { - // MainLog.Instance.Verbose("DATASTORE", "Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); + // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); } } } Commit(); - // MainLog.Instance.Verbose("Dump of prims:", ds.GetXml()); + // m_log.Info("[Dump of prims]: " + ds.GetXml()); } public void RemoveObject(LLUUID obj, LLUUID regionUUID) { - MainLog.Instance.Verbose("DATASTORE", "Removing obj: {0} from region: {1}", obj.UUID, regionUUID); + m_log.Info(String.Format("[DATASTORE]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID)); DataTable prims = ds.Tables["prims"]; DataTable shapes = ds.Tables["primshapes"]; @@ -274,7 +276,7 @@ namespace OpenSim.Framework.Data.SQLite lock (ds) { DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); - MainLog.Instance.Verbose("DATASTORE", + m_log.Info("[DATASTORE]: " + "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); foreach (DataRow primRow in primsForRegion) @@ -296,7 +298,7 @@ namespace OpenSim.Framework.Data.SQLite } else { - MainLog.Instance.Notice( + m_log.Info( "No shape found for prim in storage, so setting default box shape"); prim.Shape = PrimitiveBaseShape.Default; } @@ -316,7 +318,7 @@ namespace OpenSim.Framework.Data.SQLite } else { - MainLog.Instance.Notice( + m_log.Info( "No shape found for prim in storage, so setting default box shape"); prim.Shape = PrimitiveBaseShape.Default; } @@ -330,11 +332,11 @@ namespace OpenSim.Framework.Data.SQLite } catch (Exception e) { - MainLog.Instance.Error("DATASTORE", "Failed create prim object, exception and data follows"); - MainLog.Instance.Verbose("DATASTORE", e.ToString()); + m_log.Error("[DATASTORE]: Failed create prim object, exception and data follows"); + m_log.Info("[DATASTORE]: " + e.ToString()); foreach (DataColumn col in prims.Columns) { - MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]); + m_log.Info("[DATASTORE]: Col: " + col.ColumnName + " => " + primRow[col]); } } } @@ -348,7 +350,7 @@ namespace OpenSim.Framework.Data.SQLite /// private void LoadItems(SceneObjectPart prim) { - MainLog.Instance.Verbose("DATASTORE", "Loading inventory for {0}, {1}", prim.Name, prim.UUID); + m_log.Info(String.Format("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID)); DataTable dbItems = ds.Tables["primitems"]; @@ -362,7 +364,7 @@ namespace OpenSim.Framework.Data.SQLite TaskInventoryItem item = buildItem(row); inventory.Add(item); - MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.Name, item.ItemID); + m_log.Info(String.Format("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID)); } prim.RestoreInventoryItems(inventory); @@ -383,7 +385,7 @@ namespace OpenSim.Framework.Data.SQLite // the following is an work around for .NET. The perf // issues associated with it aren't as bad as you think. - MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); + m_log.Info("[DATASTORE]: Storing terrain revision r" + revision.ToString()); String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + " values(:RegionUUID, :Revision, :Heightfield)"; @@ -446,11 +448,11 @@ namespace OpenSim.Framework.Data.SQLite } else { - MainLog.Instance.Verbose("DATASTORE", "No terrain found for region"); + m_log.Info("[DATASTORE]: No terrain found for region"); return null; } - MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); + m_log.Info("[DATASTORE]: Loaded terrain revision r" + rev.ToString()); } } return terret; @@ -1265,7 +1267,7 @@ namespace OpenSim.Framework.Data.SQLite if (!persistPrimInventories) return; - MainLog.Instance.Verbose("DATASTORE", "Entered StorePrimInventory with prim ID {0}", primID); + m_log.Info(String.Format("[DATASTORE]: Entered StorePrimInventory with prim ID {0}", primID)); DataTable dbItems = ds.Tables["primitems"]; @@ -1278,10 +1280,10 @@ namespace OpenSim.Framework.Data.SQLite // repalce with current inventory details foreach (TaskInventoryItem newItem in items) { -// MainLog.Instance.Verbose( -// "DATASTORE", -// "Adding item {0}, {1} to prim ID {2}", -// newItem.Name, newItem.ItemID, newItem.ParentPartID); +// m_log.Info(String.Format( +// "[DATASTORE]: ", +// "Adding item {0}, {1} to prim ID {2}", +// newItem.Name, newItem.ItemID, newItem.ParentPartID)); DataRow newItemRow = dbItems.NewRow(); fillItemRow(newItemRow, newItem); @@ -1508,7 +1510,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Warn("SQLITE", "Primitives Table Already Exists"); + m_log.Warn("[SQLITE]: Primitives Table Already Exists"); } try @@ -1517,7 +1519,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Warn("SQLITE", "Shapes Table Already Exists"); + m_log.Warn("[SQLITE]: Shapes Table Already Exists"); } if (persistPrimInventories) @@ -1528,7 +1530,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Warn("SQLITE", "Primitives Inventory Table Already Exists"); + m_log.Warn("[SQLITE]: Primitives Inventory Table Already Exists"); } } @@ -1538,7 +1540,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Warn("SQLITE", "Terrain Table Already Exists"); + m_log.Warn("[SQLITE]: Terrain Table Already Exists"); } try @@ -1547,7 +1549,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Warn("SQLITE", "Land Table Already Exists"); + m_log.Warn("[SQLITE]: Land Table Already Exists"); } try @@ -1556,7 +1558,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Warn("SQLITE", "LandAccessList Table Already Exists"); + m_log.Warn("[SQLITE]: LandAccessList Table Already Exists"); } conn.Close(); } @@ -1596,7 +1598,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); + m_log.Info("[DATASTORE]: SQLite Database doesn't exist... creating"); InitDB(conn); } @@ -1614,7 +1616,7 @@ namespace OpenSim.Framework.Data.SQLite { if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); return false; } } @@ -1623,7 +1625,7 @@ namespace OpenSim.Framework.Data.SQLite { if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); return false; } } @@ -1634,7 +1636,7 @@ namespace OpenSim.Framework.Data.SQLite { if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); return false; } } @@ -1643,7 +1645,7 @@ namespace OpenSim.Framework.Data.SQLite { if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); return false; } } @@ -1652,7 +1654,7 @@ namespace OpenSim.Framework.Data.SQLite { if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); return false; } } diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index ac7340ddc6..2316de8400 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs @@ -39,6 +39,8 @@ namespace OpenSim.Framework.Data.SQLite /// public class SQLiteUserData : SQLiteBase, IUserData { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// The database manager /// @@ -89,7 +91,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Verbose("SQLITE", "userfriends table not found, creating.... "); + m_log.Info("[SQLITE]: userfriends table not found, creating.... "); InitDB(conn); daf.Fill(ds.Tables["userfriends"]); } @@ -217,7 +219,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (Exception ex) { - MainLog.Instance.Error("USER", "Exception getting friends list for user: " + ex.ToString()); + m_log.Error("[USER]: Exception getting friends list for user: " + ex.ToString()); } } @@ -231,7 +233,7 @@ namespace OpenSim.Framework.Data.SQLite public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) { - MainLog.Instance.Verbose("USER", "Stub UpdateUserCUrrentRegion called"); + m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); } @@ -339,7 +341,7 @@ namespace OpenSim.Framework.Data.SQLite DataRow row = users.Rows.Find(Util.ToRawUuidString(AgentID)); if (row == null) { - MainLog.Instance.Warn("WEBLOGIN", "Unable to store new web login key for non-existant user"); + m_log.Warn("[WEBLOGIN]: Unable to store new web login key for non-existant user"); } else { @@ -411,7 +413,7 @@ namespace OpenSim.Framework.Data.SQLite } } - MainLog.Instance.Verbose("SQLITE", + m_log.Info("[SQLITE]: " + "Syncing user database: " + ds.Tables["users"].Rows.Count + " users stored"); // save changes off to disk da.Update(ds, "users"); @@ -775,7 +777,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (System.Exception) { - MainLog.Instance.Verbose("USERS", "users table already exists"); + m_log.Info("[USERS]: users table already exists"); } try @@ -784,7 +786,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (System.Exception) { - MainLog.Instance.Verbose("USERS", "userfriends table already exists"); + m_log.Info("[USERS]: userfriends table already exists"); } conn.Close(); @@ -807,7 +809,7 @@ namespace OpenSim.Framework.Data.SQLite } catch (SqliteSyntaxException) { - MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); + m_log.Info("[DATASTORE]: SQLite Database doesn't exist... creating"); InitDB(conn); } conn.Open(); diff --git a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs index 57cf4cf9db..4ef500ccea 100644 --- a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs @@ -63,4 +63,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly : AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index b5a3468a19..26924ebb2e 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -28,11 +28,14 @@ using System; using System.IO; using libsecondlife; +using OpenSim.Framework.Console; namespace OpenSim.Framework { public class EstateSettings { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + //Settings to this island private float m_billableFactor; @@ -734,7 +737,7 @@ namespace OpenSim.Framework } else { - OpenSim.Framework.Console.MainLog.Instance.Error("ESTATESETTINGS", "Unable to locate estate manager : " + avatarID.ToString() + " for removal"); + m_log.Error("[ESTATESETTINGS]: Unable to locate estate manager : " + avatarID.ToString() + " for removal"); } } @@ -749,7 +752,7 @@ namespace OpenSim.Framework { configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", - loadConfigurationOptions, handleIncomingConfiguration,true); + loadConfigurationOptions, handleIncomingConfiguration, true); configMember.performConfigurationRetrieve(); } } diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs index 61a53d7d9c..0723756d87 100644 --- a/OpenSim/Framework/GridConfig.cs +++ b/OpenSim/Framework/GridConfig.cs @@ -27,6 +27,7 @@ */ using System; +using OpenSim.Framework.Console; namespace OpenSim.Framework { diff --git a/OpenSim/Framework/InventoryConfig.cs b/OpenSim/Framework/InventoryConfig.cs index 108e7ffd0e..0c13df5498 100644 --- a/OpenSim/Framework/InventoryConfig.cs +++ b/OpenSim/Framework/InventoryConfig.cs @@ -26,6 +26,8 @@ * */ +using OpenSim.Framework.Console; + namespace OpenSim.Framework { /// diff --git a/OpenSim/Framework/MessageServerConfig.cs b/OpenSim/Framework/MessageServerConfig.cs index ccb6e7a7e1..c7fee8528e 100644 --- a/OpenSim/Framework/MessageServerConfig.cs +++ b/OpenSim/Framework/MessageServerConfig.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.Text; +using OpenSim.Framework.Console; namespace OpenSim.Framework { diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 751ca9d8c8..e953182d11 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -31,6 +31,7 @@ using System.Net.Sockets; using System.Xml; using libsecondlife; using Nini.Config; +using OpenSim.Framework.Console; namespace OpenSim.Framework { @@ -176,7 +177,7 @@ namespace OpenSim.Framework public string MasterAvatarSandboxPassword = String.Empty; // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. - private static EstateSettings m_estateSettings; + private EstateSettings m_estateSettings; public EstateSettings EstateSettings { @@ -196,7 +197,7 @@ namespace OpenSim.Framework public RegionInfo(string description, string filename, bool skipConsoleConfig) { configMember = - new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration,!skipConsoleConfig); + new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); configMember.performConfigurationRetrieve(); } diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index 8a1a03871c..76d0b34ec8 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs @@ -35,6 +35,8 @@ namespace OpenSim.Framework.RegionLoader.Web { public class RegionLoaderWebServer : IRegionLoader { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private IniConfigSource m_configSouce; public void SetIniConfigSource(IniConfigSource configSource) @@ -46,7 +48,7 @@ namespace OpenSim.Framework.RegionLoader.Web { if (m_configSouce == null) { - MainLog.Instance.Error("WEBLOADER", "Unable to load configuration source!"); + m_log.Error("[WEBLOADER]: Unable to load configuration source!"); return null; } else @@ -55,16 +57,16 @@ namespace OpenSim.Framework.RegionLoader.Web string url = startupConfig.GetString("regionload_webserver_url", System.String.Empty).Trim(); if (url == System.String.Empty) { - MainLog.Instance.Error("WEBLOADER", "Unable to load webserver URL - URL was empty."); + m_log.Error("[WEBLOADER]: Unable to load webserver URL - URL was empty."); return null; } else { HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); webRequest.Timeout = 30000; //30 Second Timeout - MainLog.Instance.Debug("WEBLOADER", "Sending Download Request..."); + m_log.Debug("[WEBLOADER]: Sending Download Request..."); HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); - MainLog.Instance.Debug("WEBLOADER", "Downloading Region Information From Remote Server..."); + m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server..."); StreamReader reader = new StreamReader(webResponse.GetResponseStream()); string xmlSource = System.String.Empty; string tempStr = reader.ReadLine(); @@ -73,9 +75,8 @@ namespace OpenSim.Framework.RegionLoader.Web xmlSource = xmlSource + tempStr; tempStr = reader.ReadLine(); } - MainLog.Instance.Debug("WEBLOADER", - "Done downloading region information from server. Total Bytes: " + - xmlSource.Length); + m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + + xmlSource.Length); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlSource); if (xmlDoc.FirstChild.Name == "Regions") @@ -84,7 +85,7 @@ namespace OpenSim.Framework.RegionLoader.Web int i; for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) { - MainLog.Instance.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); + m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); regionInfos[i] = new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false); } diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index df3b049f63..cc0c0d00db 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -41,6 +41,8 @@ namespace OpenSim.Framework.Servers { public class BaseHttpServer { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected Thread m_workerThread; protected HttpListener m_httpListener; protected Dictionary m_rpcHandlers = new Dictionary(); @@ -296,7 +298,7 @@ namespace OpenSim.Framework.Servers } catch (Exception ex) { - MainLog.Instance.Warn("HTTPD", "Error - " + ex.Message); + m_log.Warn("[HTTPD]: Error - " + ex.Message); } finally { @@ -319,7 +321,7 @@ namespace OpenSim.Framework.Servers LLSD llsdResponse = null; try { llsdRequest = LLSDParser.DeserializeXml(requestBody); } - catch (Exception ex) { MainLog.Instance.Warn("HTTPD", "Error - " + ex.Message); } + catch (Exception ex) { m_log.Warn("[HTTPD]: Error - " + ex.Message); } if (llsdRequest != null && m_llsdHandler != null) { @@ -348,7 +350,7 @@ namespace OpenSim.Framework.Servers } catch (Exception ex) { - MainLog.Instance.Warn("HTTPD", "Error - " + ex.Message); + m_log.Warn("[HTTPD]: Error - " + ex.Message); } finally { @@ -396,7 +398,7 @@ namespace OpenSim.Framework.Servers foreach (string headername in rHeaders) { - //MainLog.Instance.Warn("HEADER", headername + "=" + request.Headers[headername]); + //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); headervals[headername] = request.Headers[headername]; } @@ -407,9 +409,9 @@ namespace OpenSim.Framework.Servers if (keysvals.Contains("method")) { - //MainLog.Instance.Warn("HTTP", "Contains Method"); + //m_log.Warn("[HTTP]: Contains Method"); string method = (string) keysvals["method"]; - //MainLog.Instance.Warn("HTTP", requestBody); + //m_log.Warn("[HTTP]: " + requestBody); GenericHTTPMethod requestprocessor; bool foundHandler = TryGetHTTPHandler(method, out requestprocessor); if (foundHandler) @@ -422,13 +424,13 @@ namespace OpenSim.Framework.Servers } else { - //MainLog.Instance.Warn("HTTP", "Handler Not Found"); + //m_log.Warn("[HTTP]: Handler Not Found"); SendHTML404(response, host); } } else { - //MainLog.Instance.Warn("HTTP", "No Method specified"); + //m_log.Warn("[HTTP]: No Method specified"); SendHTML404(response, host); } } @@ -461,7 +463,7 @@ namespace OpenSim.Framework.Servers } catch (Exception ex) { - MainLog.Instance.Warn("HTTPD", "Error - " + ex.Message); + m_log.Warn("[HTTPD]: Error - " + ex.Message); } finally { @@ -488,7 +490,7 @@ namespace OpenSim.Framework.Servers } catch (Exception ex) { - MainLog.Instance.Warn("HTTPD", "Error - " + ex.Message); + m_log.Warn("[HTTPD]: Error - " + ex.Message); } finally { @@ -513,7 +515,7 @@ namespace OpenSim.Framework.Servers } catch (Exception ex) { - MainLog.Instance.Warn("HTTPD", "Error - " + ex.Message); + m_log.Warn("[HTTPD]: Error - " + ex.Message); } finally { @@ -523,7 +525,7 @@ namespace OpenSim.Framework.Servers public void Start() { - MainLog.Instance.Verbose("HTTPD", "Starting up HTTP Server"); + m_log.Info("[HTTPD]: Starting up HTTP Server"); m_workerThread = new Thread(new ThreadStart(StartHTTP)); m_workerThread.IsBackground = true; @@ -534,7 +536,7 @@ namespace OpenSim.Framework.Servers { try { - MainLog.Instance.Verbose("HTTPD", "Spawned main thread OK"); + m_log.Info("[HTTPD]: Spawned main thread OK"); m_httpListener = new HttpListener(); if (!m_ssl) @@ -556,7 +558,7 @@ namespace OpenSim.Framework.Servers } catch (Exception e) { - MainLog.Instance.Warn("HTTPD", "Error - " + e.Message); + m_log.Warn("[HTTPD]: Error - " + e.Message); } } diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 3016715481..4831446b5b 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -27,7 +27,6 @@ */ using System; - using OpenSim.Framework.Console; namespace OpenSim.Framework.Servers @@ -37,8 +36,7 @@ namespace OpenSim.Framework.Servers /// public abstract class BaseOpenSimServer { - protected LogBase m_log; - + protected ConsoleBase m_console; protected DateTime m_startuptime; public BaseOpenSimServer() @@ -56,7 +54,7 @@ namespace OpenSim.Framework.Servers switch (command) { case "help": - m_log.Notice("show uptime - show server startup and uptime."); + m_console.Notice("show uptime - show server startup and uptime."); break; case "show": @@ -77,8 +75,8 @@ namespace OpenSim.Framework.Servers switch (ShowWhat) { case "uptime": - m_log.Notice("Server has been running since " + m_startuptime.ToString()); - m_log.Notice("That is " + (DateTime.Now - m_startuptime).ToString()); + m_console.Notice("Server has been running since " + m_startuptime.ToString()); + m_console.Notice("That is " + (DateTime.Now - m_startuptime).ToString()); break; } } diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs index 47b3f2456b..6599d86450 100644 --- a/OpenSim/Framework/Servers/CheckSumServer.cs +++ b/OpenSim/Framework/Servers/CheckSumServer.cs @@ -31,7 +31,7 @@ namespace OpenSim.Framework.Servers /* public class CheckSumServer : UDPServerBase { - //protected ConsoleBase m_log; + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public CheckSumServer(int port) : base(port) @@ -114,7 +114,7 @@ namespace OpenSim.Framework.Servers } catch (Exception) { - MainLog.Instance.Warn("CheckSumServer.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection "); + m_log.Warn("CheckSumServer.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection "); } } diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs index a4b8a5dfc6..3a2f384bce 100644 --- a/OpenSim/Framework/UserConfig.cs +++ b/OpenSim/Framework/UserConfig.cs @@ -27,6 +27,7 @@ */ using System; +using OpenSim.Framework.Console; namespace OpenSim.Framework { diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index a95ea71ddc..35e6495642 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs @@ -43,6 +43,8 @@ namespace OpenSim.Grid.AssetServer /// public class OpenAsset_Main : BaseOpenSimServer, conscmd_callback { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public AssetConfig m_config; public static OpenAsset_Main assetserver; @@ -55,7 +57,9 @@ namespace OpenSim.Grid.AssetServer [STAThread] public static void Main(string[] args) { - Console.WriteLine("Starting...\n"); + log4net.Config.XmlConfigurator.Configure(); + + m_log.Info("Starting...\n"); assetserver = new OpenAsset_Main(); assetserver.Startup(); @@ -65,42 +69,32 @@ namespace OpenSim.Grid.AssetServer private void Work() { - m_log.Notice("Enter help for a list of commands"); + m_console.Notice("Enter help for a list of commands"); while (true) { - m_log.MainLogPrompt(); + m_console.Prompt(); } } private OpenAsset_Main() { - if (!Directory.Exists(Util.logDir())) - { - Directory.CreateDirectory(Util.logDir()); - } + m_console = new ConsoleBase("OpenAsset", this); - m_log = - new LogBase( - (Path.Combine(Util.logDir(), "opengrid-AssetServer-console.log")), - "OpenAsset", - this, - true); - - MainLog.Instance = m_log; + MainConsole.Instance = m_console; } public void Startup() { m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml"))); - m_log.Verbose("ASSET", "Setting up asset DB"); + m_log.Info("[ASSET]: Setting up asset DB"); setupDB(m_config); - m_log.Verbose("ASSET", "Loading default asset set.."); + m_log.Info("[ASSET]: Loading default asset set.."); LoadDefaultAssets(); - m_log.Verbose("ASSET", "Starting HTTP process"); + m_log.Info("[ASSET]: Starting HTTP process"); BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); StatsManager.StartCollectingAssetStats(); @@ -118,7 +112,7 @@ namespace OpenSim.Grid.AssetServer public IAssetProvider LoadDatabasePlugin(string FileName) { - MainLog.Instance.Verbose("ASSET SERVER", "LoadDatabasePlugin: Attempting to load " + FileName); + m_log.Info("[ASSET SERVER]: LoadDatabasePlugin: Attempting to load " + FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName); IAssetProvider assetPlugin = null; foreach (Type pluginType in pluginAssembly.GetTypes()) @@ -134,7 +128,7 @@ namespace OpenSim.Grid.AssetServer assetPlugin = plug; assetPlugin.Initialise(); - MainLog.Instance.Verbose("ASSET SERVER", "Added " + assetPlugin.Name + " " + assetPlugin.Version); + m_log.Info("[ASSET SERVER]: Added " + assetPlugin.Name + " " + assetPlugin.Version); break; } @@ -153,14 +147,14 @@ namespace OpenSim.Grid.AssetServer m_assetProvider = LoadDatabasePlugin(config.DatabaseProvider); if (m_assetProvider == null) { - MainLog.Instance.Error("ASSET", "Failed to load a database plugin, server halting"); + m_log.Error("[ASSET]: Failed to load a database plugin, server halting"); Environment.Exit(-1); } } catch (Exception e) { - MainLog.Instance.Warn("ASSET", "setupDB() - Exception occured"); - MainLog.Instance.Warn("ASSET", e.ToString()); + m_log.Warn("[ASSET]: setupDB() - Exception occured"); + m_log.Warn("[ASSET]: " + e.ToString()); } } @@ -181,18 +175,18 @@ namespace OpenSim.Grid.AssetServer switch (cmd) { case "help": - m_log.Notice( + m_console.Notice( @"shutdown - shutdown this asset server (USE CAUTION!) stats - statistical information for this server"); break; case "stats": - m_log.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report()); + m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report()); break; case "shutdown": - m_log.Close(); + m_console.Close(); Environment.Exit(0); break; } diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index 5c497b6e9b..cb9e1aed73 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs @@ -41,6 +41,8 @@ namespace OpenSim.Grid.AssetServer { public class GetAssetStreamHandler : BaseStreamHandler { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private OpenAsset_Main m_assetManager; private IAssetProvider m_assetProvider; @@ -52,7 +54,7 @@ namespace OpenSim.Grid.AssetServer public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) : base("GET", "/assets") { - MainLog.Instance.Verbose("REST", "In Get Request"); + m_log.Info("[REST]: In Get Request"); m_assetManager = assetManager; m_assetProvider = assetProvider; } @@ -71,8 +73,8 @@ namespace OpenSim.Grid.AssetServer if (!LLUUID.TryParse(p[0], out assetID)) { - MainLog.Instance.Verbose( - "REST", "GET:/asset ignoring request with malformed UUID {0}", p[0]); + m_log.Info(String.Format( + "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0])); return result; } @@ -94,10 +96,9 @@ namespace OpenSim.Grid.AssetServer result = ms.GetBuffer(); - MainLog.Instance.Verbose( - "REST", - "GET:/asset found {0} with name {1}, size {2} bytes", - assetID, asset.Name, result.Length); + m_log.Info(String.Format( + "[REST]: GET:/asset found {0} with name {1}, size {2} bytes", + assetID, asset.Name, result.Length)); Array.Resize(ref result, (int) ms.Length); } @@ -106,13 +107,13 @@ namespace OpenSim.Grid.AssetServer if (StatsManager.AssetStats != null) StatsManager.AssetStats.AddNotFoundRequest(); - MainLog.Instance.Verbose("REST", "GET:/asset failed to find {0}", assetID); + m_log.Info(String.Format("[REST]: GET:/asset failed to find {0}", assetID)); } } } catch (Exception e) { - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); } return result; } @@ -120,6 +121,8 @@ namespace OpenSim.Grid.AssetServer public class PostAssetStreamHandler : BaseStreamHandler { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private OpenAsset_Main m_assetManager; private IAssetProvider m_assetProvider; @@ -135,7 +138,7 @@ namespace OpenSim.Grid.AssetServer XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); AssetBase asset = (AssetBase) xs.Deserialize(request); - MainLog.Instance.Verbose("REST", "StoreAndCommitAsset {0}", asset.FullID); + m_log.Info(String.Format("[REST]: StoreAndCommitAsset {0}", asset.FullID)); m_assetProvider.CreateAsset(asset); m_assetProvider.CommitAssets(); diff --git a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs index e8225e193d..5dde43dfe3 100644 --- a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs +++ b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs @@ -38,13 +38,15 @@ namespace OpenGrid.Config.GridConfigDb4o /// public class Db40ConfigPlugin: IGridConfig { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// Loads and returns a configuration objeect /// /// A grid configuration object public GridConfig GetConfigObject() { - MainLog.Instance.Verbose("DBGRIDCONFIG", "Loading Db40Config dll"); + m_log.Info("[DBGRIDCONFIG]: Loading Db40Config dll"); return new DbGridConfig(); } } @@ -64,24 +66,24 @@ namespace OpenGrid.Config.GridConfigDb4o /// public void LoadDefaults() { - MainLog.Instance.Notice("DbGridConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); + MainConsole.Instance.Info("DbGridConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); // About the grid options - this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team"); + this.GridOwner = MainConsole.Instance.CmdPrompt("Grid owner", "OGS development team"); // Asset Options - this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/"); - this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null"); - this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null"); + this.DefaultAssetServer = MainConsole.Instance.CmdPrompt("Default asset server","http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/"); + this.AssetSendKey = MainConsole.Instance.CmdPrompt("Key to send to asset server","null"); + this.AssetRecvKey = MainConsole.Instance.CmdPrompt("Key to expect from asset server","null"); // User Server Options - this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/"); - this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null"); - this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null"); + this.DefaultUserServer = MainConsole.Instance.CmdPrompt("Default user server","http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/"); + this.UserSendKey = MainConsole.Instance.CmdPrompt("Key to send to user server","null"); + this.UserRecvKey = MainConsole.Instance.CmdPrompt("Key to expect from user server","null"); // Region Server Options - this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null"); - this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null"); + this.SimSendKey = MainConsole.Instance.CmdPrompt("Key to send to sims","null"); + this.SimRecvKey = MainConsole.Instance.CmdPrompt("Key to expect from sims","null"); } /// @@ -99,7 +101,7 @@ namespace OpenGrid.Config.GridConfigDb4o // Found? if (result.Count==1) { - MainLog.Instance.Verbose("DBGRIDCONFIG", "Found a GridConfig object in the local database, loading"); + m_log.Info("[DBGRIDCONFIG]: Found a GridConfig object in the local database, loading"); foreach (DbGridConfig cfg in result) { // Import each setting into this class @@ -121,13 +123,13 @@ namespace OpenGrid.Config.GridConfigDb4o } else { - MainLog.Instance.Verbose("DBGRIDCONFIG", "Could not find object in database, loading precompiled defaults"); + m_log.Info("[DBGRIDCONFIG]: Could not find object in database, loading precompiled defaults"); // Load default settings into this class LoadDefaults(); // Saves to the database file... - MainLog.Instance.Verbose("DBGRIDCONFIG", "Writing out default settings to local database"); + m_log.Info("[DBGRIDCONFIG]: Writing out default settings to local database"); db.Set(this); // Closes file locks @@ -136,27 +138,27 @@ namespace OpenGrid.Config.GridConfigDb4o } catch(Exception e) { - MainLog.Instance.Warn("DbGridConfig.cs:InitConfig() - Exception occured"); - MainLog.Instance.Warn(e.ToString()); + m_log.Warn("DbGridConfig.cs:InitConfig() - Exception occured"); + m_log.Warn(e.ToString()); } // Grid Settings - MainLog.Instance.Verbose("DBGRIDCONFIG", "Grid settings loaded:"); - MainLog.Instance.Verbose("DBGRIDCONFIG", "Grid owner: " + this.GridOwner); + m_log.Info("[DBGRIDCONFIG]: Grid settings loaded:"); + m_log.Info("[DBGRIDCONFIG]: Grid owner: " + this.GridOwner); // Asset Settings - MainLog.Instance.Verbose("DBGRIDCONFIG", "Default asset server: " + this.DefaultAssetServer); - MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to send to asset server: " + this.AssetSendKey); - MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to expect from asset server: " + this.AssetRecvKey); + m_log.Info("[DBGRIDCONFIG]: Default asset server: " + this.DefaultAssetServer); + m_log.Info("[DBGRIDCONFIG]: Key to send to asset server: " + this.AssetSendKey); + m_log.Info("[DBGRIDCONFIG]: Key to expect from asset server: " + this.AssetRecvKey); // User Settings - MainLog.Instance.Verbose("DBGRIDCONFIG", "Default user server: " + this.DefaultUserServer); - MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to send to user server: " + this.UserSendKey); - MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to expect from user server: " + this.UserRecvKey); + m_log.Info("[DBGRIDCONFIG]: Default user server: " + this.DefaultUserServer); + m_log.Info("[DBGRIDCONFIG]: Key to send to user server: " + this.UserSendKey); + m_log.Info("[DBGRIDCONFIG]: Key to expect from user server: " + this.UserRecvKey); // Region Settings - MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to send to sims: " + this.SimSendKey); - MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to expect from sims: " + this.SimRecvKey); + m_log.Info("[DBGRIDCONFIG]: Key to send to sims: " + this.SimSendKey); + m_log.Info("[DBGRIDCONFIG]: Key to expect from sims: " + this.SimRecvKey); } /// diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index c956a01098..49b9aa2764 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -38,11 +38,12 @@ using OpenSim.Framework.Console; using OpenSim.Framework.Data; using OpenSim.Framework.Servers; - namespace OpenSim.Grid.GridServer { internal class GridManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private Dictionary _plugins = new Dictionary(); private Dictionary _logplugins = new Dictionary(); @@ -57,10 +58,10 @@ namespace OpenSim.Grid.GridServer /// The filename to the grid server plugin DLL public void AddPlugin(string FileName) { - MainLog.Instance.Verbose("DATA", "Attempting to load " + FileName); + m_log.Info("[DATA]: Attempting to load " + FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName); - MainLog.Instance.Verbose("DATA", "Found " + pluginAssembly.GetTypes().Length + " interfaces."); + m_log.Info("[DATA]: Found " + pluginAssembly.GetTypes().Length + " interfaces."); foreach (Type pluginType in pluginAssembly.GetTypes()) { if (!pluginType.IsAbstract) @@ -74,7 +75,7 @@ namespace OpenSim.Grid.GridServer (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); _plugins.Add(plug.getName(), plug); - MainLog.Instance.Verbose("DATA", "Added IGridData Interface"); + m_log.Info("[DATA]: Added IGridData Interface"); } typeInterface = null; @@ -88,7 +89,7 @@ namespace OpenSim.Grid.GridServer (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); _logplugins.Add(plug.getName(), plug); - MainLog.Instance.Verbose("DATA", "Added ILogData Interface"); + m_log.Info("[DATA]: Added ILogData Interface"); } typeInterface = null; @@ -116,7 +117,7 @@ namespace OpenSim.Grid.GridServer } catch (Exception) { - MainLog.Instance.Warn("storage", "Unable to write log via " + kvp.Key); + m_log.Warn("[storage]: Unable to write log via " + kvp.Key); } } } @@ -136,7 +137,7 @@ namespace OpenSim.Grid.GridServer } catch (Exception e) { - MainLog.Instance.Warn("storage", "getRegion - " + e.Message); + m_log.Warn("[storage]: getRegion - " + e.Message); } } return null; @@ -157,7 +158,7 @@ namespace OpenSim.Grid.GridServer } catch { - MainLog.Instance.Warn("storage", "Unable to find region " + handle.ToString() + " via " + kvp.Key); + m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + kvp.Key); } } return null; @@ -179,7 +180,7 @@ namespace OpenSim.Grid.GridServer } catch { - MainLog.Instance.Warn("storage", "Unable to query regionblock via " + kvp.Key); + m_log.Warn("[storage]: Unable to query regionblock via " + kvp.Key); } } @@ -245,14 +246,14 @@ namespace OpenSim.Grid.GridServer } else { - MainLog.Instance.Verbose("GRID", "Region connected without a UUID, ignoring."); + m_log.Info("[GRID]: Region connected without a UUID, ignoring."); responseData["error"] = "No UUID passed to grid server - unable to connect you"; return response; } if (TheSim == null) // Shouldnt this be in the REST Simulator Set method? { - MainLog.Instance.Verbose("GRID", "New region connecting"); + m_log.Info("[GRID]: New region connecting"); myword = "creation"; } else @@ -320,7 +321,7 @@ namespace OpenSim.Grid.GridServer (OldSim.regionRecvKey == TheSim.regionRecvKey && OldSim.regionSendKey == TheSim.regionSendKey)) { - MainLog.Instance.Verbose("GRID", "Adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + + m_log.Info("[GRID]: Adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.serverURI); foreach (KeyValuePair kvp in _plugins) { @@ -330,17 +331,17 @@ namespace OpenSim.Grid.GridServer switch (insertResponse) { case DataResponse.RESPONSE_OK: - MainLog.Instance.Verbose("grid", "New sim " + myword + " successful: " + TheSim.regionName); + m_log.Info("[grid]: New sim " + myword + " successful: " + TheSim.regionName); break; case DataResponse.RESPONSE_ERROR: - MainLog.Instance.Warn("storage", "New sim creation failed (Error): " + TheSim.regionName); + m_log.Warn("[storage]: New sim creation failed (Error): " + TheSim.regionName); break; case DataResponse.RESPONSE_INVALIDCREDENTIALS: - MainLog.Instance.Warn("storage", + m_log.Warn("[storage]: " + "New sim creation failed (Invalid Credentials): " + TheSim.regionName); break; case DataResponse.RESPONSE_AUTHREQUIRED: - MainLog.Instance.Warn("storage", + m_log.Warn("[storage]: " + "New sim creation failed (Authentication Required): " + TheSim.regionName); break; @@ -348,9 +349,9 @@ namespace OpenSim.Grid.GridServer } catch (Exception e) { - MainLog.Instance.Warn("storage", + m_log.Warn("[storage]: " + "Unable to add region " + TheSim.UUID.ToString() + " via " + kvp.Key); - MainLog.Instance.Warn("storage", e.ToString()); + m_log.Warn("[storage]: " + e.ToString()); } @@ -458,14 +459,14 @@ namespace OpenSim.Grid.GridServer } else { - MainLog.Instance.Warn("grid", "Authentication failed when trying to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName); + m_log.Warn("[grid]: Authentication failed when trying to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName); responseData["error"] = "The key required to connect to your region did not match. Please check your send and recieve keys."; return response; } } else { - MainLog.Instance.Warn("grid", "Failed to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName); + m_log.Warn("[grid]: Failed to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName); responseData["error"] = "Another region already exists at that location. Try another"; return response; } @@ -496,7 +497,7 @@ namespace OpenSim.Grid.GridServer } else { - MainLog.Instance.Verbose("DATA", "found " + (string) simData.regionName + " regionHandle = " + + m_log.Info("[DATA]: found " + (string) simData.regionName + " regionHandle = " + (string) requestData["region_handle"]); responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); responseData["sim_port"] = simData.serverPort.ToString(); @@ -535,8 +536,8 @@ namespace OpenSim.Grid.GridServer { ymax = (Int32) requestData["ymax"]; } - //CFK: The second MainLog is more meaningful and either standard or fast generally occurs. - //CFK: MainLog.Instance.Verbose("MAP", "World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); + //CFK: The second log is more meaningful and either standard or fast generally occurs. + //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); @@ -575,7 +576,7 @@ namespace OpenSim.Grid.GridServer simProfileList.Add(simProfileBlock); } - MainLog.Instance.Verbose("MAP", "Fast map " + simProfileList.Count.ToString() + + m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() + " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); } else @@ -610,7 +611,7 @@ namespace OpenSim.Grid.GridServer } } } - MainLog.Instance.Verbose("MAP", "Std map " + simProfileList.Count.ToString() + + m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() + " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); } @@ -776,7 +777,7 @@ namespace OpenSim.Grid.GridServer try { - MainLog.Instance.Verbose("DATA", + m_log.Info("[DATA]: " + "Updating / adding via " + _plugins.Count + " storage provider(s) registered."); foreach (KeyValuePair kvp in _plugins) { @@ -789,13 +790,13 @@ namespace OpenSim.Grid.GridServer (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) { kvp.Value.AddProfile(TheSim); - MainLog.Instance.Verbose("grid", "New sim added to grid (" + TheSim.regionName + ")"); + m_log.Info("[grid]: New sim added to grid (" + TheSim.regionName + ")"); logToDB(TheSim.UUID.ToString(), "RestSetSimMethod", String.Empty, 5, "Region successfully updated and connected to grid."); } else { - MainLog.Instance.Warn("grid", + m_log.Warn("[grid]: " + "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); return "Unable to update region (RestSetSimMethod): Incorrect auth key."; @@ -803,7 +804,7 @@ namespace OpenSim.Grid.GridServer } catch (Exception e) { - MainLog.Instance.Warn("GRID", "getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + + m_log.Warn("[GRID]: getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); } } diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index 8a522c2baf..ff4a888842 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs @@ -39,6 +39,8 @@ namespace OpenSim.Grid.GridServer /// public class OpenGrid_Main : BaseOpenSimServer, conscmd_callback { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public GridConfig Cfg; public static OpenGrid_Main thegrid; @@ -54,11 +56,13 @@ namespace OpenSim.Grid.GridServer [STAThread] public static void Main(string[] args) { + log4net.Config.XmlConfigurator.Configure(); + if (args.Length > 0) { if (args[0] == "-setuponly") setuponly = true; } - Console.WriteLine("Starting...\n"); + m_log.Info("Starting...\n"); thegrid = new OpenGrid_Main(); thegrid.Startup(); @@ -68,23 +72,18 @@ namespace OpenSim.Grid.GridServer private void Work() { - m_log.Notice("Enter help for a list of commands\n"); + m_console.Notice("Enter help for a list of commands\n"); while (true) { - m_log.MainLogPrompt(); + m_console.Prompt(); } } private OpenGrid_Main() { - if (!Directory.Exists(Util.logDir())) - { - Directory.CreateDirectory(Util.logDir()); - } - m_log = - new LogBase((Path.Combine(Util.logDir(), "opengrid-gridserver-console.log")), "OpenGrid", this, true); - MainLog.Instance = m_log; + m_console = new ConsoleBase("OpenGrid", this); + MainConsole.Instance = m_console; } public void managercallback(string cmd) @@ -97,19 +96,18 @@ namespace OpenSim.Grid.GridServer } } - public void Startup() { Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); //Yeah srsly, that's it. if (setuponly) Environment.Exit(0); - m_log.Verbose("GRID", "Connecting to Storage Server"); + m_log.Info("[GRID]: Connecting to Storage Server"); m_gridManager = new GridManager(); m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win m_gridManager.config = Cfg; - m_log.Verbose("GRID", "Starting HTTP process"); + m_log.Info("[GRID]: Starting HTTP process"); BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); @@ -135,7 +133,7 @@ namespace OpenSim.Grid.GridServer httpServer.Start(); - m_log.Verbose("GRID", "Starting sim status checker"); + m_log.Info("[GRID]: Starting sim status checker"); Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates. simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); @@ -186,11 +184,11 @@ namespace OpenSim.Grid.GridServer switch (cmd) { case "help": - m_log.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); break; case "shutdown": - m_log.Close(); + m_console.Close(); Environment.Exit(0); break; } diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index d36a915900..a7194529c6 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -37,6 +37,8 @@ namespace OpenSim.Grid.InventoryServer { public class GridInventoryService : InventoryServiceBase { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) { @@ -108,7 +110,7 @@ namespace OpenSim.Grid.InventoryServer LLUUID userID = new LLUUID(rawUserID); // We get enough verbose messages later on for diagnostics - //MainLog.Instance.Verbose("INVENTORY", "Request for inventory for " + userID.ToString()); + //m_log.Info("[INVENTORY]: Request for inventory for " + userID.ToString()); InventoryCollection invCollection = new InventoryCollection(); List folders; @@ -126,8 +128,8 @@ namespace OpenSim.Grid.InventoryServer { LLUUID userID = new LLUUID(rawUserID); - MainLog.Instance.Verbose( - "INVENTORY", "Creating new set of inventory folders for " + userID.ToString()); + m_log.Info( + "[INVENTORY]: Creating new set of inventory folders for " + userID.ToString()); CreateNewUserInventory(userID); return true; @@ -152,8 +154,8 @@ namespace OpenSim.Grid.InventoryServer public bool AddInventoryFolder(InventoryFolderBase folder) { // Right now, this actions act more like an update/insert combination than a simple create. - MainLog.Instance.Verbose( - "INVENTORY", + m_log.Info( + "[INVENTORY]: " + "Updating in " + folder.parentID.ToString() + ", folder " + folder.name); @@ -163,8 +165,8 @@ namespace OpenSim.Grid.InventoryServer public bool MoveInventoryFolder(InventoryFolderBase folder) { - MainLog.Instance.Verbose( - "INVENTORY", + m_log.Info( + "[INVENTORY]: " + "Moving folder " + folder.folderID + " to " + folder.parentID.ToString()); @@ -175,8 +177,8 @@ namespace OpenSim.Grid.InventoryServer public bool AddInventoryItem(InventoryItemBase item) { // Right now, this actions act more like an update/insert combination than a simple create. - MainLog.Instance.Verbose( - "INVENTORY", + m_log.Info( + "[INVENTORY]: " + "Updating in " + item.parentFolderID.ToString() + ", item " + item.inventoryName); @@ -187,8 +189,8 @@ namespace OpenSim.Grid.InventoryServer public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) { // extra spaces to align with other inventory messages - MainLog.Instance.Verbose( - "INVENTORY", + m_log.Info( + "[INVENTORY]: " + "Deleting in " + item.parentFolderID.ToString() + ", item " + item.inventoryName); diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs index 6ca50645a1..35b66b2911 100644 --- a/OpenSim/Grid/InventoryServer/InventoryManager.cs +++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs @@ -41,6 +41,8 @@ namespace OpenSim.Grid.InventoryServer { public class InventoryManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private IInventoryData _databasePlugin; /// @@ -49,10 +51,10 @@ namespace OpenSim.Grid.InventoryServer /// The filename to the inventory server plugin DLL public void AddDatabasePlugin(string FileName) { - MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Attempting to load " + FileName); + m_log.Info("[" + OpenInventory_Main.LogName + "]: Invenstorage: Attempting to load " + FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName); - MainLog.Instance.Verbose(OpenInventory_Main.LogName, + m_log.Info("[" + OpenInventory_Main.LogName + "]: " + "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); foreach (Type pluginType in pluginAssembly.GetTypes()) { @@ -66,7 +68,7 @@ namespace OpenSim.Grid.InventoryServer (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); _databasePlugin = plug; - MainLog.Instance.Verbose(OpenInventory_Main.LogName, + m_log.Info("[" + OpenInventory_Main.LogName + "]: " + "Invenstorage: Added IInventoryData Interface"); break; } @@ -156,7 +158,7 @@ namespace OpenSim.Grid.InventoryServer saveInventoryToStream(_inventory, fs); fs.Flush(); fs.Close(); - MainLog.Instance.Debug(OpenInventory_Main.LogName, "Modified"); + m_log.Debug("[" + OpenInventory_Main.LogName + "]: Modified"); } } @@ -166,14 +168,14 @@ namespace OpenSim.Grid.InventoryServer private byte[] GetUserInventory(LLUUID userID) { - MainLog.Instance.Notice(OpenInventory_Main.LogName, "Getting Inventory for user {0}", userID.ToString()); + m_log.Info(String.Format("[" + OpenInventory_Main.LogName + "]: Getting Inventory for user {0}", userID.ToString())); byte[] result = new byte[] {}; InventoryFolderBase fb = _manager._databasePlugin.getUserRootFolder(userID); if (fb == null) { - MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new", - userID.ToString()); + m_log.Info(String.Format("[" + OpenInventory_Main.LogName + "]: Inventory not found for user {0}, creating new", + userID.ToString())); CreateDefaultInventory(userID); } diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index b62c696ef4..5037c7d0de 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -38,6 +38,8 @@ namespace OpenSim.Grid.InventoryServer { public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private InventoryManager m_inventoryManager; private InventoryConfig m_config; private GridInventoryService m_inventoryService; @@ -47,6 +49,8 @@ namespace OpenSim.Grid.InventoryServer [STAThread] public static void Main(string[] args) { + log4net.Config.XmlConfigurator.Configure(); + OpenInventory_Main theServer = new OpenInventory_Main(); theServer.Startup(); @@ -55,20 +59,20 @@ namespace OpenSim.Grid.InventoryServer public OpenInventory_Main() { - m_log = new LogBase("opengrid-inventory-console.log", LogName, this, true); - MainLog.Instance = m_log; + m_console = new ConsoleBase(LogName, this); + MainConsole.Instance = m_console; } public void Startup() { - MainLog.Instance.Notice("Initialising inventory manager..."); + m_log.Info("Initialising inventory manager..."); m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml"))); m_inventoryService = new GridInventoryService(); // m_inventoryManager = new InventoryManager(); m_inventoryService.AddPlugin(m_config.DatabaseProvider); - MainLog.Instance.Notice(LogName, "Starting HTTP server ..."); + m_log.Info("[" + LogName + "]: Starting HTTP server ..."); BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); httpServer.AddStreamHandler( new RestDeserialisehandler("POST", "/GetInventory/", @@ -95,19 +99,19 @@ namespace OpenSim.Grid.InventoryServer new RestDeserialisehandler>("POST", "/RootFolders/", m_inventoryService.RequestFirstLevelFolders)); - // httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); + // httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); httpServer.Start(); - MainLog.Instance.Notice(LogName, "Started HTTP server"); + m_log.Info("[" + LogName + "]: Started HTTP server"); } private void Work() { - m_log.Notice("Enter help for a list of commands\n"); + m_console.Notice("Enter help for a list of commands\n"); while (true) { - m_log.MainLogPrompt(); + m_console.Prompt(); } } @@ -122,7 +126,7 @@ namespace OpenSim.Grid.InventoryServer m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID); break; case "shutdown": - m_log.Close(); + m_console.Close(); Environment.Exit(0); break; } diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index 3d5ceb4af0..c16b0f8395 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs @@ -41,6 +41,8 @@ namespace OpenSim.Grid.MessagingServer /// public class OpenMessage_Main : BaseOpenSimServer, conscmd_callback { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private MessageServerConfig Cfg; //public UserManager m_userManager; @@ -51,7 +53,9 @@ namespace OpenSim.Grid.MessagingServer [STAThread] public static void Main(string[] args) { - Console.WriteLine("Launching MessagingServer..."); + log4net.Config.XmlConfigurator.Configure(); + + m_log.Info("Launching MessagingServer..."); OpenMessage_Main messageserver = new OpenMessage_Main(); @@ -61,22 +65,17 @@ namespace OpenSim.Grid.MessagingServer private OpenMessage_Main() { - if (!Directory.Exists(Util.logDir())) - { - Directory.CreateDirectory(Util.logDir()); - } - m_log = - new LogBase((Path.Combine(Util.logDir(), "opengrid-messagingserver-console.log")), "OpenMessage", this, true); - MainLog.Instance = m_log; + m_console = new ConsoleBase("OpenMessage", this); + MainConsole.Instance = m_console; } private void Work() { - m_log.Notice("Enter help for a list of commands\n"); + m_console.Notice("Enter help for a list of commands\n"); while (true) { - m_log.MainLogPrompt(); + m_console.Prompt(); } } @@ -84,9 +83,7 @@ namespace OpenSim.Grid.MessagingServer { Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); - - - MainLog.Instance.Verbose("REGION", "Starting HTTP process"); + m_log.Info("[REGION]: Starting HTTP process"); BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); //httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); @@ -104,10 +101,9 @@ namespace OpenSim.Grid.MessagingServer //new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); httpServer.Start(); - m_log.Status("SERVER", "Messageserver 0.4 - Startup complete"); + m_log.Info("[SERVER]: Messageserver 0.4 - Startup complete"); } - public void do_create(string what) { switch (what) @@ -120,7 +116,7 @@ namespace OpenSim.Grid.MessagingServer //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); } catch (Exception ex) { - m_log.Error("SERVER", "Error creating user: {0}", ex.ToString()); + m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString()); } try @@ -130,9 +126,9 @@ namespace OpenSim.Grid.MessagingServer } catch (Exception ex) { - m_log.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); + m_console.Error("[SERVER]: Error creating inventory for user: {0}", ex.ToString()); } - // m_lastCreatedUser = userID; + // m_lastCreatedUser = userID; break; } } @@ -144,11 +140,11 @@ namespace OpenSim.Grid.MessagingServer switch (cmd) { case "help": - m_log.Notice("shutdown - shutdown the message server (USE CAUTION!)"); + m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)"); break; case "shutdown": - m_log.Close(); + m_console.Close(); Environment.Exit(0); break; } diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs index 056bfcb1c2..c2669b041a 100644 --- a/OpenSim/Grid/MessagingServer/MessageService.cs +++ b/OpenSim/Grid/MessagingServer/MessageService.cs @@ -43,7 +43,8 @@ namespace OpenSim.Grid.MessagingServer { public class MessageService { - private LogBase m_log; + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private MessageServerConfig m_cfg; //A hashtable of all current presences this server knows about @@ -58,13 +59,10 @@ namespace OpenSim.Grid.MessagingServer // Hashtable containing work units that need to be processed private Hashtable m_unProcessedWorkUnits = new Hashtable(); - - public MessageService(LogBase log, MessageServerConfig cfg) + public MessageService(MessageServerConfig cfg) { - m_log = log; m_cfg = cfg; } - #region RegionComms Methods @@ -84,7 +82,7 @@ namespace OpenSim.Grid.MessagingServer ArrayList SendParams = new ArrayList(); SendParams.Add(PresenceParams); - MainLog.Instance.Verbose("PRESENCE", "Informing " + whichRegion.regionName + " at " + whichRegion.httpServerURI); + m_log.Info("[PRESENCE]: Informing " + whichRegion.regionName + " at " + whichRegion.httpServerURI); // Send XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams); XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); @@ -292,7 +290,7 @@ namespace OpenSim.Grid.MessagingServer } catch (WebException e) { - MainLog.Instance.Warn("Error when trying to fetch Avatar's friends list: " + + m_log.Warn("Error when trying to fetch Avatar's friends list: " + e.Message); // Return Empty list (no friends) } @@ -439,7 +437,7 @@ namespace OpenSim.Grid.MessagingServer if (responseData.ContainsKey("error")) { - m_log.Error("GRID","error received from grid server" + responseData["error"]); + m_log.Error("[GRID]: error received from grid server" + responseData["error"]); return null; } @@ -465,7 +463,7 @@ namespace OpenSim.Grid.MessagingServer } catch (WebException) { - MainLog.Instance.Error("GRID", + m_log.Error("[GRID]: " + "Region lookup failed for: " + regionHandle.ToString() + " - Is the GridServer down?"); return null; diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs index 98a2cc53e4..bcfeefc963 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs @@ -26,10 +26,13 @@ * */ /* Original code: Tedd Hansen */ + namespace OpenSim.Grid.ScriptEngine.DotNetEngine { public static class Common { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public static bool debug = true; public static ScriptEngine mySE; @@ -41,14 +44,14 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine public static void SendToDebug(string Message) { //if (Debug == true) - mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); + mySE.m_log.Info("[ScriptEngine]: Debug: " + Message); //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); } public static void SendToLog(string Message) { //if (Debug == true) - mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); + mySE.m_log.Info("[ScriptEngine]: LOG: " + Message); //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); } } diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 1f5e6da072..e0a5461f7f 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs @@ -41,6 +41,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL //[Serializable] public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + // Object never expires public override Object InitializeLifetimeService() { @@ -87,7 +89,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL { m_LSL_Functions = LSL_Functions; - //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called."); + //m_log.Info("[ScriptEngine]: LSL_BaseClass.Start() called."); // Get this AppDomain's settings and display some of them. AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index 8f58b55ed3..1ffbd3af66 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs @@ -52,6 +52,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler /// public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private ASCIIEncoding enc = new ASCIIEncoding(); private ScriptEngine m_ScriptEngine; private SceneObjectPart m_host; @@ -68,7 +70,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler m_itemID = itemID; - //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); + //m_log.Info("[ScriptEngine]: LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); } diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs index 3a1ae5aa6b..3aa2216a90 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs @@ -38,17 +38,19 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine [Serializable] internal class EventManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private ScriptEngine myScriptEngine; //public IScriptHost TEMP_OBJECT_ID; public EventManager(ScriptEngine _ScriptEngine) { myScriptEngine = _ScriptEngine; // TODO: HOOK EVENTS UP TO SERVER! - //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Start"); + //myScriptEngine.m_log.Info("[ScriptEngine]: EventManager Start"); // TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager // Hook up a test event to our test form - myScriptEngine.Log.Verbose("ScriptEngine", "Hooking up to server events"); + myScriptEngine.m_log.Info("[ScriptEngine]: Hooking up to server events"); myScriptEngine.World.EventManager.OnObjectGrab += touch_start; myScriptEngine.World.EventManager.OnRezScript += OnRezScript; myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; @@ -57,7 +59,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) { // Add to queue for all scripts in ObjectID object - //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); + //myScriptEngine.m_log.Info("[ScriptEngine]: EventManager Event: touch_start"); //Console.WriteLine("touch_start localID: " + localID); myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1}); } diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs index d9d26aaa68..260686213c 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs @@ -44,6 +44,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine [Serializable] internal class EventQueueManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// List of threads processing event queue /// @@ -118,7 +120,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine } catch (Exception) { - //myScriptEngine.Log.Verbose("ScriptEngine", "EventQueueManager Exception killing worker thread: " + e.ToString()); + //myScriptEngine.m_log.Info("[ScriptEngine]: EventQueueManager Exception killing worker thread: " + e.ToString()); } } } @@ -132,7 +134,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine /// private void EventQueueThreadLoop() { - //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Worker thread spawned"); + //myScriptEngine.m_log.Info("[ScriptEngine]: EventQueueManager Worker thread spawned"); try { QueueItemStruct BlankQIS = new QueueItemStruct(); @@ -151,7 +153,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine else { // Something in queue, process - //myScriptEngine.m_logger.Verbose("ScriptEngine", "Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName); + //myScriptEngine.m_log.Info("[ScriptEngine]: Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName); // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD lock (queueLock) @@ -237,7 +239,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine } // try catch (ThreadAbortException) { - //myScriptEngine.Log.Verbose("ScriptEngine", "EventQueueManager Worker thread killed: " + tae.Message); + //myScriptEngine.m_log.Info("[ScriptEngine]: EventQueueManager Worker thread killed: " + tae.Message); } } @@ -287,7 +289,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine public void AddToObjectQueue(uint localID, string FunctionName, object[] param) { // Determine all scripts in Object and add to their queue - //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); + //myScriptEngine.m_log.Info("[ScriptEngine]: EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); // Do we have any scripts in this object at all? If not, return diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs index cc6cde2600..a45efe9ff8 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs @@ -40,6 +40,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine [Serializable] public class ScriptEngine : IRegionModule { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + internal Scene World; internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim internal EventQueueManager m_EventQueueManager; // Executes events @@ -47,7 +49,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine internal AppDomainManager m_AppDomainManager; internal LSLLongCmdHandler m_LSLLongCmdHandler; - private LogBase m_log; public ScriptEngine() { @@ -55,19 +56,13 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine Common.mySE = this; } - public LogBase Log - { - get { return m_log; } - } - - public void InitializeEngine(Scene Sceneworld, LogBase logger) + public void InitializeEngine(Scene Sceneworld) { World = Sceneworld; - m_log = logger; - Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing"); + m_log.Info("[ScriptEngine]: DotNet & LSL ScriptEngine initializing"); - //m_logger.Status("ScriptEngine", "InitializeEngine"); + //m_log.Info("[ScriptEngine]: InitializeEngine"); // Create all objects we'll be using m_EventQueueManager = new EventQueueManager(this); @@ -90,7 +85,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine //public void StartScript(string ScriptID, IScriptHost ObjectID) //{ // this.myEventManager.TEMP_OBJECT_ID = ObjectID; - // Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID); + // m_log.Info("[ScriptEngine]: DEBUG FUNCTION: StartScript: " + ScriptID); // myScriptManager.StartScript(ScriptID, ObjectID); //} @@ -98,7 +93,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine public void Initialise(Scene scene, IConfigSource config) { - InitializeEngine(scene, MainLog.Instance); + InitializeEngine(scene); } public void PostInitialise() diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs index f4828342cc..28463990ee 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -48,6 +48,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine [Serializable] public class ScriptManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + #region Declares private Thread scriptLoadUnloadThread; @@ -312,7 +314,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine } catch (Exception e) { - //m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString()); + //m_scriptEngine.m_log.Error("[ScriptEngine]: Error compiling script: " + e.ToString()); try { // DISPLAY ERROR INWORLD @@ -323,7 +325,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine } catch (Exception e2) { - m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); + m_scriptEngine.m_log.Error("[ScriptEngine]: Error displaying error in-world: " + e2.ToString()); } } } @@ -384,7 +386,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args) { // Execute a function in the script - //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); + //m_scriptEngine.m_log.Info("[ScriptEngine]: Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID); if (Script == null) return; diff --git a/OpenSim/Grid/ScriptServer/Application.cs b/OpenSim/Grid/ScriptServer/Application.cs index 5857101115..26bd42617d 100644 --- a/OpenSim/Grid/ScriptServer/Application.cs +++ b/OpenSim/Grid/ScriptServer/Application.cs @@ -37,6 +37,8 @@ namespace OpenSim.Grid.ScriptServer private static void Main(string[] args) { + log4net.Config.XmlConfigurator.Configure(); + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs index 819a037470..595acea47b 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 // Maintains connection and communication to a region public class RegionConnectionManager : RegionBase { - private LogBase m_log; private ScriptServerMain m_ScriptServerMain; private object m_Connection; - public RegionConnectionManager(ScriptServerMain scm, LogBase logger, object Connection) + public RegionConnectionManager(ScriptServerMain scm, object Connection) { m_ScriptServerMain = scm; - m_log = logger; m_Connection = Connection; } diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs index 7d29129d71..524b8c4852 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs @@ -38,13 +38,11 @@ namespace OpenSim.Grid.ScriptServer private List Regions = new List(); - private LogBase m_log; private ScriptServerMain m_ScriptServerMain; - public RegionCommManager(ScriptServerMain scm, LogBase logger) + public RegionCommManager(ScriptServerMain scm) { m_ScriptServerMain = scm; - m_log = logger; } ~RegionCommManager() @@ -96,9 +94,8 @@ namespace OpenSim.Grid.ScriptServer // ~ ask scriptengines if they will accept script? // - Add script to shared communication channel towards that region - // TODO: FAKING A CONNECTION - Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null)); + Regions.Add(new RegionConnectionManager(m_ScriptServerMain, null)); } } } \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs index c9c0fb0b95..4bb74f538b 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs @@ -35,13 +35,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer { internal class ScriptEngineLoader { - private LogBase m_log; - - - public ScriptEngineLoader(LogBase logger) - { - m_log = logger; - } + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public ScriptServerInterfaces.ScriptEngine LoadScriptEngine(string EngineName) { @@ -55,7 +49,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer } catch (Exception e) { - m_log.Error("ScriptEngine", + m_log.Error("[ScriptEngine]: " + "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString()); } @@ -87,7 +81,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer //} //catch (Exception e) //{ - // m_log.Error("ScriptEngine", "Error loading assembly \String.Empty + FileName + "\": " + e.ToString()); + // m_log.Error("[ScriptEngine]: Error loading assembly \String.Empty + FileName + "\": " + e.ToString()); //} @@ -104,7 +98,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer //} //catch (Exception e) //{ - // m_log.Error("ScriptEngine", "Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); + // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); //} ScriptServerInterfaces.ScriptEngine ret; @@ -114,7 +108,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer //} //catch (Exception e) //{ - // m_log.Error("ScriptEngine", "Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); + // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); //} return ret; diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs index 3bfca87ab1..7976cb58a1 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs @@ -34,17 +34,15 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer { internal class ScriptEngineManager { - private LogBase m_log; private ScriptEngineLoader ScriptEngineLoader; private List scriptEngines = new List(); private ScriptServerMain m_ScriptServerMain; // Initialize - public ScriptEngineManager(ScriptServerMain scm, LogBase logger) + public ScriptEngineManager(ScriptServerMain scm) { m_ScriptServerMain = scm; - m_log = logger; - ScriptEngineLoader = new ScriptEngineLoader(m_log); + ScriptEngineLoader = new ScriptEngineLoader(); } ~ScriptEngineManager() diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs index 421467da75..e2c83f1428 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs @@ -40,11 +40,12 @@ namespace OpenSim.Grid.ScriptServer { public class ScriptServerMain : BaseOpenSimServer, conscmd_callback { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + // // Root object. Creates objects used. // private int listenPort = 8010; - private readonly string m_logFilename = ("scriptserver.log"); // TEMP public static ScriptServerInterfaces.ScriptEngine Engine; @@ -59,16 +60,15 @@ namespace OpenSim.Grid.ScriptServer public ScriptServerMain() { - m_log = CreateLog(); - + m_console = CreateConsole(); // Set up script engine mananger - ScriptEngines = new ScriptEngineManager(this, m_log); + ScriptEngines = new ScriptEngineManager(this); // Load DotNetEngine Engine = ScriptEngines.LoadEngine("DotNetEngine"); IConfigSource config = null; - Engine.InitializeEngine(null, null, m_log, false, Engine.GetScriptManager()); + Engine.InitializeEngine(null, null, false, Engine.GetScriptManager()); // Set up server @@ -83,12 +83,12 @@ namespace OpenSim.Grid.ScriptServer private void RPC_ReceiveCommand(int ID, string Command, object[] p) { - m_log.Notice("SERVER", "Received command: '" + Command + "'"); + m_log.Info("[SERVER]: Received command: '" + Command + "'"); if (p != null) { for (int i = 0; i < p.Length; i++) { - m_log.Notice("SERVER", "Param " + i + ": " + p[i].ToString()); + m_log.Info("[SERVER]: Param " + i + ": " + p[i].ToString()); } } @@ -102,14 +102,9 @@ namespace OpenSim.Grid.ScriptServer { } - protected LogBase CreateLog() + protected ConsoleBase CreateConsole() { - if (!Directory.Exists(Util.logDir())) - { - Directory.CreateDirectory(Util.logDir()); - } - - return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "ScriptServer", this, true); + return new ConsoleBase("ScriptServer", this); } } } diff --git a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs index d2736c6ef6..865dfea689 100644 --- a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs +++ b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs @@ -35,9 +35,11 @@ namespace OpenUser.Config.UserConfigDb4o { public class Db4oConfigPlugin: IUserConfig { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public UserConfig GetConfigObject() { - MainLog.Instance.Verbose("DBUSERCONFIG", "Loading Db40Config dll"); + m_log.Info("[DBUSERCONFIG]: Loading Db40Config dll"); return ( new DbUserConfig()); } } @@ -48,13 +50,13 @@ namespace OpenUser.Config.UserConfigDb4o public void LoadDefaults() { - MainLog.Instance.Notice("DbUserConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); + m_log.Info("DbUserConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); - this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS"); + this.DefaultStartupMsg = m_log.CmdPrompt("Default startup message", "Welcome to OGS"); - this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/"); - this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null"); - this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null"); + this.GridServerURL = m_log.CmdPrompt("Grid server URL","http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/"); + this.GridSendKey = m_log.CmdPrompt("Key to send to grid server","null"); + this.GridRecvKey = m_log.CmdPrompt("Key to expect from grid server","null"); } public override void InitConfig() @@ -65,7 +67,7 @@ namespace OpenUser.Config.UserConfigDb4o IObjectSet result = db.Get(typeof(DbUserConfig)); if(result.Count==1) { - MainLog.Instance.Verbose("DBUSERCONFIG", "DbUserConfig.cs:InitConfig() - Found a UserConfig object in the local database, loading"); + m_log.Info("[DBUSERCONFIG]: DbUserConfig.cs:InitConfig() - Found a UserConfig object in the local database, loading"); foreach (DbUserConfig cfg in result) { this.GridServerURL=cfg.GridServerURL; @@ -76,24 +78,24 @@ namespace OpenUser.Config.UserConfigDb4o } else { - MainLog.Instance.Verbose("DBUSERCONFIG", "DbUserConfig.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); + m_log.Info("[DBUSERCONFIG]: DbUserConfig.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); LoadDefaults(); - MainLog.Instance.Verbose("DBUSERCONFIG", "Writing out default settings to local database"); + m_log.Info("[DBUSERCONFIG]: Writing out default settings to local database"); db.Set(this); db.Close(); } } catch(Exception e) { - MainLog.Instance.Warn("DbUserConfig.cs:InitConfig() - Exception occured"); - MainLog.Instance.Warn(e.ToString()); + m_log.Warn("DbUserConfig.cs:InitConfig() - Exception occured"); + m_log.Warn(e.ToString()); } - MainLog.Instance.Verbose("DBUSERCONFIG", "User settings loaded:"); - MainLog.Instance.Verbose("DBUSERCONFIG", "Default startup message: " + this.DefaultStartupMsg); - MainLog.Instance.Verbose("DBUSERCONFIG", "Grid server URL: " + this.GridServerURL); - MainLog.Instance.Verbose("DBUSERCONFIG", "Key to send to grid: " + this.GridSendKey); - MainLog.Instance.Verbose("DBUSERCONFIG", "Key to expect from grid: " + this.GridRecvKey); + m_log.Info("[DBUSERCONFIG]: User settings loaded:"); + m_log.Info("[DBUSERCONFIG]: Default startup message: " + this.DefaultStartupMsg); + m_log.Info("[DBUSERCONFIG]: Grid server URL: " + this.GridServerURL); + m_log.Info("[DBUSERCONFIG]: Key to send to grid: " + this.GridSendKey); + m_log.Info("[DBUSERCONFIG]: Key to expect from grid: " + this.GridRecvKey); } public void Shutdown() diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 32cefc1c8b..8b9fd622ba 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -42,6 +42,8 @@ namespace OpenSim.Grid.UserServer /// public class OpenUser_Main : BaseOpenSimServer, conscmd_callback { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private UserConfig Cfg; public UserManager m_userManager; @@ -53,7 +55,9 @@ namespace OpenSim.Grid.UserServer [STAThread] public static void Main(string[] args) { - Console.WriteLine("Launching UserServer..."); + log4net.Config.XmlConfigurator.Configure(); + + m_log.Info("Launching UserServer..."); OpenUser_Main userserver = new OpenUser_Main(); @@ -63,22 +67,17 @@ namespace OpenSim.Grid.UserServer private OpenUser_Main() { - if (!Directory.Exists(Util.logDir())) - { - Directory.CreateDirectory(Util.logDir()); - } - m_log = - new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true); - MainLog.Instance = m_log; + m_console = new ConsoleBase("OpenUser", this); + MainConsole.Instance = m_console; } private void Work() { - m_log.Notice("Enter help for a list of commands\n"); + m_console.Notice("Enter help for a list of commands\n"); while (true) { - m_log.MainLogPrompt(); + m_console.Prompt(); } } @@ -88,7 +87,7 @@ namespace OpenSim.Grid.UserServer StatsManager.StartCollectingUserStats(); - MainLog.Instance.Verbose("REGION", "Establishing data connection"); + m_log.Info("[REGION]: Establishing data connection"); m_userManager = new UserManager(); m_userManager._config = Cfg; m_userManager.AddPlugin(Cfg.DatabaseProvider); @@ -96,11 +95,11 @@ namespace OpenSim.Grid.UserServer m_loginService = new UserLoginService( m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); - m_messagesService = new MessageServersConnector(MainLog.Instance); + m_messagesService = new MessageServersConnector(); m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation; - MainLog.Instance.Verbose("REGION", "Starting HTTP process"); + m_log.Info("[REGION]: Starting HTTP process"); BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); @@ -128,10 +127,9 @@ namespace OpenSim.Grid.UserServer new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); httpServer.Start(); - m_log.Status("SERVER", "Userserver 0.4 - Startup complete"); + m_log.Info("[SERVER]: Userserver 0.4 - Startup complete"); } - public void do_create(string what) { switch (what) @@ -143,11 +141,11 @@ namespace OpenSim.Grid.UserServer uint regX = 1000; uint regY = 1000; - tempfirstname = m_log.CmdPrompt("First name"); - templastname = m_log.CmdPrompt("Last name"); - tempMD5Passwd = m_log.PasswdPrompt("Password"); - regX = Convert.ToUInt32(m_log.CmdPrompt("Start Region X")); - regY = Convert.ToUInt32(m_log.CmdPrompt("Start Region Y")); + tempfirstname = m_console.CmdPrompt("First name"); + templastname = m_console.CmdPrompt("Last name"); + tempMD5Passwd = m_console.PasswdPrompt("Password"); + regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); + regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); @@ -158,7 +156,7 @@ namespace OpenSim.Grid.UserServer m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); } catch (Exception ex) { - m_log.Error("SERVER", "Error creating user: {0}", ex.ToString()); + m_log.Error(String.Format("[SERVER]: Error creating user: {0}", ex.ToString())); } try @@ -168,7 +166,7 @@ namespace OpenSim.Grid.UserServer } catch (Exception ex) { - m_log.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); + m_log.Error(String.Format("[SERVER]: Error creating inventory for user: {0}", ex.ToString())); } m_lastCreatedUser = userID; break; @@ -182,9 +180,9 @@ namespace OpenSim.Grid.UserServer switch (cmd) { case "help": - m_log.Notice("create user - create a new user"); - m_log.Notice("stats - statistical information for this server"); - m_log.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + m_console.Notice("create user - create a new user"); + m_console.Notice("stats - statistical information for this server"); + m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); break; case "create": @@ -193,12 +191,12 @@ namespace OpenSim.Grid.UserServer case "shutdown": m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; - m_log.Close(); + m_console.Close(); Environment.Exit(0); break; case "stats": - MainLog.Instance.Notice("STATS", Environment.NewLine + StatsManager.UserStats.Report()); + m_console.Notice(StatsManager.UserStats.Report()); break; case "test-inventory": @@ -218,8 +216,9 @@ namespace OpenSim.Grid.UserServer public void TestResponse(List resp) { - Console.WriteLine("response got"); + m_console.Notice("response got"); } + public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) { m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, Position); diff --git a/OpenSim/Grid/UserServer/MessageServersConnector.cs b/OpenSim/Grid/UserServer/MessageServersConnector.cs index 93d5925c6f..251644bd5b 100644 --- a/OpenSim/Grid/UserServer/MessageServersConnector.cs +++ b/OpenSim/Grid/UserServer/MessageServersConnector.cs @@ -39,15 +39,14 @@ using OpenSim.Framework.Servers; namespace OpenSim.Grid.UserServer { - public class MessageServersConnector { - private LogBase m_log; + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public Dictionary MessageServers; - public MessageServersConnector(LogBase log) + public MessageServersConnector() { - m_log=log; MessageServers = new Dictionary(); } @@ -65,7 +64,7 @@ namespace OpenSim.Grid.UserServer { if (!MessageServers.ContainsKey(URI)) { - m_log.Warn("MSGSERVER", "Got addResponsibleRegion Request for a MessageServer that isn't registered"); + m_log.Warn("[MSGSERVER]: Got addResponsibleRegion Request for a MessageServer that isn't registered"); } else { @@ -78,7 +77,7 @@ namespace OpenSim.Grid.UserServer { if (!MessageServers.ContainsKey(URI)) { - m_log.Warn("MSGSERVER", "Got RemoveResponsibleRegion Request for a MessageServer that isn't registered"); + m_log.Warn("[MSGSERVER]: Got RemoveResponsibleRegion Request for a MessageServer that isn't registered"); } else { @@ -175,10 +174,7 @@ namespace OpenSim.Grid.UserServer XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams); XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000); - m_log.Verbose("LOGIN","Notified : " + serv.URI + " about user login"); - + m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login"); } - - } } diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 10f9468c4f..d5cdf1c9ea 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -46,9 +46,10 @@ namespace OpenSim.Grid.UserServer { public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position); - public class UserLoginService : LoginService { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public event UserLoggedInAtLocation OnUserLoggedInAtLocation; public UserConfig m_config; @@ -70,7 +71,7 @@ namespace OpenSim.Grid.UserServer { bool tryDefault = false; //CFK: Since the try is always "tried", the "Home Location" message should always appear, so comment this one. - //CFK: MainLog.Instance.Verbose("LOGIN", "Load information from the gridserver"); + //CFK: m_log.Info("[LOGIN]: Load information from the gridserver"); RegionProfileData SimInfo = new RegionProfileData(); try { @@ -80,7 +81,7 @@ namespace OpenSim.Grid.UserServer // Customise the response //CFK: This is redundant and the next message should always appear. - //CFK: MainLog.Instance.Verbose("LOGIN", "Home Location"); + //CFK: m_log.Info("[LOGIN]: Home Location"); response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" + (SimInfo.regionLocY*256).ToString() + "], " + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + @@ -91,7 +92,7 @@ namespace OpenSim.Grid.UserServer // Destination //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into //CFK: the next one for X & Y and comment this one. - //CFK: MainLog.Instance.Verbose("LOGIN", "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + + //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + //CFK: "; Region Y: " + SimInfo.regionLocY); response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); response.SimPort = (uint) SimInfo.serverPort; @@ -105,7 +106,7 @@ namespace OpenSim.Grid.UserServer // Notify the target of an incoming user //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into //CFK: the next one for X & Y and comment this one. - //CFK: MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " (" + SimInfo.serverURI + ") " + + //CFK: m_log.Info("[LOGIN]: " + SimInfo.regionName + " (" + SimInfo.serverURI + ") " + //CFK: SimInfo.regionLocX + "," + SimInfo.regionLocY); // Prepare notification @@ -128,7 +129,7 @@ namespace OpenSim.Grid.UserServer theUser.currentAgent.currentRegion = SimInfo.UUID; theUser.currentAgent.currentHandle = SimInfo.regionHandle; - MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " + + m_log.Info("[LOGIN]: " + SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " + SimInfo.regionLocX + "," + SimInfo.regionLocY); XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); @@ -145,9 +146,8 @@ namespace OpenSim.Grid.UserServer ulong defaultHandle = (((ulong) m_config.DefaultX*256) << 32) | ((ulong) m_config.DefaultY*256); - MainLog.Instance.Warn( - "LOGIN", - "Home region not available: sending to default " + defaultHandle.ToString()); + m_log.Warn( + "[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString()); SimInfo = new RegionProfileData(); try @@ -157,7 +157,7 @@ namespace OpenSim.Grid.UserServer m_config.GridSendKey, m_config.GridRecvKey); // Customise the response - MainLog.Instance.Verbose("LOGIN", "Home Location"); + m_log.Info("[LOGIN]: Home Location"); response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" + (SimInfo.regionLocY*256).ToString() + "], " + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + @@ -166,9 +166,9 @@ namespace OpenSim.Grid.UserServer theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; // Destination - MainLog.Instance.Verbose("LOGIN", - "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + - SimInfo.regionLocY); + m_log.Info("[LOGIN]: " + + "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + + SimInfo.regionLocY); response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); response.SimPort = (uint) SimInfo.serverPort; response.RegionX = SimInfo.regionLocX; @@ -179,7 +179,7 @@ namespace OpenSim.Grid.UserServer response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; // Notify the target of an incoming user - MainLog.Instance.Verbose("LOGIN", "Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); + m_log.Info("[LOGIN]: Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); // Update agent with target sim theUser.currentAgent.currentRegion = SimInfo.UUID; @@ -201,7 +201,7 @@ namespace OpenSim.Grid.UserServer ArrayList SendParams = new ArrayList(); SendParams.Add(SimParams); - MainLog.Instance.Verbose("LOGIN", "Informing region at " + SimInfo.httpServerURI); + m_log.Info("[LOGIN]: Informing region at " + SimInfo.httpServerURI); // Send XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); @@ -213,8 +213,8 @@ namespace OpenSim.Grid.UserServer catch (Exception e) { - MainLog.Instance.Warn("LOGIN", "Default region also not available"); - MainLog.Instance.Warn("LOGIN", e.ToString()); + m_log.Warn("[LOGIN]: Default region also not available"); + m_log.Warn("[LOGIN]: " + e.ToString()); } } } @@ -230,8 +230,8 @@ namespace OpenSim.Grid.UserServer // which does. if (null == folders | folders.Count == 0) { - MainLog.Instance.Warn( - "LOGIN", + m_log.Warn( + "[LOGIN]: " + "A root inventory folder for user ID " + userID + " was not found. A new set" + " of empty inventory folders is being created."); @@ -269,8 +269,8 @@ namespace OpenSim.Grid.UserServer } else { - MainLog.Instance.Warn("LOGIN", "The root inventory folder could still not be retrieved" + - " for user ID " + userID); + m_log.Warn("[LOGIN]: The root inventory folder could still not be retrieved" + + " for user ID " + userID); AgentInventory userInventory = new AgentInventory(); userInventory.CreateRootFolder(userID, false); diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index c36de7f283..8f2d83ce24 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs @@ -39,6 +39,8 @@ namespace OpenSim.Grid.UserServer { public class UserManager : UserManagerBase { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// Deletes an active agent session /// @@ -106,6 +108,7 @@ namespace OpenSim.Grid.UserServer return response; } + /// /// Converts a user profile to an XML element which can be returned /// @@ -202,7 +205,6 @@ namespace OpenSim.Grid.UserServer responseData["returnString"] = returnString; response.Value = responseData; return response; - } public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) @@ -212,8 +214,6 @@ namespace OpenSim.Grid.UserServer Hashtable responseData = new Hashtable(); string returnString = "FALSE"; - - if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) { UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"])); @@ -233,8 +233,6 @@ namespace OpenSim.Grid.UserServer List returndata = new List(); - - if (requestData.Contains("ownerID")) { returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"])); @@ -309,7 +307,6 @@ namespace OpenSim.Grid.UserServer return CreateUnknownUserErrorResponse(); } - return ProfileToXmlRPCResponse(userProfile); } @@ -318,7 +315,6 @@ namespace OpenSim.Grid.UserServer XmlRpcResponse response = new XmlRpcResponse(); Hashtable requestData = (Hashtable)request.Params[0]; - UserProfileData userProfile; if (requestData.Contains("avatar_uuid")) @@ -336,17 +332,15 @@ namespace OpenSim.Grid.UserServer } catch (FormatException) { - OpenSim.Framework.Console.MainLog.Instance.Warn("LOGOUT", "Error in Logout XMLRPC Params"); + m_log.Warn("[LOGOUT]: Error in Logout XMLRPC Params"); return response; } - } else { return CreateUnknownUserErrorResponse(); } - return response; } diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 4c4d315567..f1db8d606c 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -35,17 +35,20 @@ namespace OpenSim { public class Application { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public static string iniFilePath = ""; //could move our main function into OpenSimMain and kill this class [STAThread] public static void Main(string[] args) { + log4net.Config.XmlConfigurator.Configure(); + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); - Console.Write("Performing compatibility checks... "); string supported = String.Empty; if (Util.IsEnvironmentSupported(ref supported)) @@ -75,11 +78,10 @@ namespace OpenSim OpenSimMain sim = new OpenSimMain(configSource); sim.StartUp(); - while (true) { - MainLog.Instance.MainLogPrompt(); + MainConsole.Instance.Prompt(); } } @@ -112,7 +114,7 @@ namespace OpenSim // Do we not always want to see exception messages? // if (e.IsTerminating) - MainLog.Instance.Error("APPLICATION", msg); + MainConsole.Instance.Error("[APPLICATION]: " + msg); // Try to post errormessage to an URL try @@ -131,6 +133,5 @@ namespace OpenSim _IsHandlingException=false; } - } } diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 36de410ff9..074a7b5243 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -55,6 +55,8 @@ namespace OpenSim public class OpenSimMain : RegionApplicationBase, conscmd_callback { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; public string m_physicsEngine; @@ -77,7 +79,6 @@ namespace OpenSim private bool m_verbose; private bool m_physicalPrim; - private readonly string m_logFilename = "region-console.log"; private bool m_permissions = false; private bool m_standaloneAuthenticate = false; @@ -146,9 +147,7 @@ namespace OpenSim { // no default config files, so set default values, and save it m_config.Merge(DefaultConfig()); - m_config.Merge(configSource); - m_config.Save(Application.iniFilePath); } } @@ -233,6 +232,8 @@ namespace OpenSim m_sandbox = !startupConfig.GetBoolean("gridmode", false); m_physicsEngine = startupConfig.GetString("physics", "basicphysics"); m_meshEngineName = startupConfig.GetString("meshing", "ZeroMesher"); + + // TODO: since log4net changes, verbose flag doesn't do anything m_verbose = startupConfig.GetBoolean("verbose", true); m_physicalPrim = startupConfig.GetBoolean("physical_prim", true); @@ -280,7 +281,6 @@ namespace OpenSim //if (!m_sandbox) //m_SendChildAgentTaskData = false; - m_networkServersInfo.loadFromConfiguration(m_config); } @@ -293,16 +293,8 @@ namespace OpenSim // Called from app startup (OpenSim.Application) // - - // Create log directory if it doesn't exist - if (!Directory.Exists(Util.logDir())) - { - Directory.CreateDirectory(Util.logDir()); - } - - // Create a log instance - m_log = CreateLog(); - MainLog.Instance = m_log; + m_console = CreateConsole(); + MainConsole.Instance = m_console; StatsManager.StartCollectingSimExtraStats(); @@ -311,7 +303,6 @@ namespace OpenSim // This base will call abstract Initialize base.StartUp(); - // StandAlone mode? m_sandbox is determined by !startupConfig.GetBoolean("gridmode", false) if (m_sandbox) { @@ -357,10 +348,10 @@ namespace OpenSim } // Create a ModuleLoader instance - m_moduleLoader = new ModuleLoader(m_log, m_config); + m_moduleLoader = new ModuleLoader(m_config); ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); - m_log.Verbose("PLUGINS", "Loading {0} OpenSim application plugins", nodes.Count); + m_log.Info(String.Format("[PLUGINS]: Loading {0} OpenSim application plugins", nodes.Count)); foreach (TypeExtensionNode node in nodes) { @@ -383,7 +374,7 @@ namespace OpenSim } else { - m_log.Verbose("STARTUP", "No startup command script specified. Moving on..."); + m_log.Info("[STARTUP]: No startup command script specified. Moving on..."); } // Start timer script (run a script every xx seconds) @@ -396,10 +387,7 @@ namespace OpenSim } // We are done with startup - m_log.Status("STARTUP", - "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); - - // When we return now we will be in a wait for input command loop. + m_log.Info("[STARTUP]: Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); } protected override void Initialize() @@ -433,8 +421,9 @@ namespace OpenSim assetServer = sqlAssetServer; } - m_assetCache = new AssetCache(assetServer, m_log); + m_assetCache = new AssetCache(assetServer); // m_assetCache = new assetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); + m_sceneManager.OnRestartSim += handleRestartRegion; } @@ -448,23 +437,23 @@ namespace OpenSim UDPServer udpServer; Scene scene = SetupScene(regionInfo, out udpServer, m_permissions); - m_log.Verbose("MODULES", "Loading Region's modules"); + m_log.Info("[MODULES]: Loading Region's modules"); m_moduleLoader.PickupModules(scene, "."); //m_moduleLoader.PickupModules(scene, "ScriptEngines"); //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); - m_log.Verbose("MODULES", "Loading scripting engine modules"); + m_log.Info("[MODULES]: Loading scripting engine modules"); foreach (string module in m_scriptEngine.Split(',')) { string mod = module.Trim(" \t".ToCharArray()); // Clean up name - m_log.Verbose("MODULES", "Loading scripting engine: " + mod); + m_log.Info("[MODULES]: Loading scripting engine: " + mod); try { m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", mod), scene); } catch (Exception ex) { - m_log.Error("MODULES", "Failed to load script engine: " + ex.ToString()); + m_log.Error("[MODULES]: Failed to load script engine: " + ex.ToString()); } } @@ -503,8 +492,7 @@ namespace OpenSim SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); if (m_SendChildAgentTaskData) { - m_log.Error("WARNING", - "Send Child Agent Task Updates is enabled. This is for testing only."); + m_log.Error("[WARNING]: Send Child Agent Task Updates is enabled. This is for testing only."); //Thread.Sleep(12000); } return @@ -516,7 +504,7 @@ namespace OpenSim public void handleRestartRegion(RegionInfo whichRegion) { - m_log.Error("MAIN", "Got restart signal from SceneManager"); + m_log.Error("[MAIN]: Got restart signal from SceneManager"); // Shutting down the UDP server bool foundUDPServer = false; int UDPServerElement = 0; @@ -557,14 +545,9 @@ namespace OpenSim //m_sceneManager.SendSimOnlineNotification(restartingRegion.RegionHandle); } - protected override LogBase CreateLog() + protected override ConsoleBase CreateConsole() { - if (!Directory.Exists(Util.logDir())) - { - Directory.CreateDirectory(Util.logDir()); - } - - return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, m_verbose); + return new ConsoleBase("Region", this); } # region Setup methods @@ -609,15 +592,15 @@ namespace OpenSim RunCommandScript(m_shutdownCommandsFile); } - m_log.Verbose("SHUTDOWN", "Closing all threads"); - m_log.Verbose("SHUTDOWN", "Killing listener thread"); - m_log.Verbose("SHUTDOWN", "Killing clients"); + m_log.Info("[SHUTDOWN]: Closing all threads"); + m_log.Info("[SHUTDOWN]: Killing listener thread"); + m_log.Info("[SHUTDOWN]: Killing clients"); // TODO: implement this - m_log.Verbose("SHUTDOWN", "Closing console and terminating"); + m_log.Info("[SHUTDOWN]: Closing console and terminating"); m_sceneManager.Close(); - m_log.Close(); + m_console.Close(); Environment.Exit(0); } @@ -637,7 +620,7 @@ namespace OpenSim /// private void RunCommandScript(string fileName) { - m_log.Verbose("COMMANDFILE", "Running " + fileName); + m_log.Info("[COMMANDFILE]: Running " + fileName); if (File.Exists(fileName)) { StreamReader readFile = File.OpenText(fileName); @@ -646,14 +629,14 @@ namespace OpenSim { if (currentCommand != String.Empty) { - m_log.Verbose("COMMANDFILE", "Running '" + currentCommand + "'"); - m_log.MainLogRunCommand(currentCommand); + m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'"); + m_console.RunCommand(currentCommand); } } } else { - m_log.Error("COMMANDFILE", "Command script missing. Can not run commands"); + m_log.Error("[COMMANDFILE]: Command script missing. Can not run commands"); } } @@ -673,7 +656,7 @@ namespace OpenSim break; case "force-update": - Console.WriteLine("Updating all clients"); + m_console.Notice("Updating all clients"); m_sceneManager.ForceCurrentSceneClientUpdate(); break; @@ -692,36 +675,36 @@ namespace OpenSim break; case "help": - m_log.Notice("alert - send alert to a designated user or all users."); - m_log.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); - m_log.Notice(" alert general [Message] - send an alert to all users."); - m_log.Notice("backup - trigger a simulator backup"); - m_log.Notice("create user - adds a new user"); - m_log.Notice("change-region [name] - sets the region that many of these commands affect."); - m_log.Notice("command-script [filename] - Execute command in a file."); - m_log.Notice("debug - debugging commands"); - m_log.Notice(" packet 0..255 - print incoming/outgoing packets (0=off)"); - m_log.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); - m_log.Notice("export-map [filename] - save image of world map"); - m_log.Notice("force-update - force an update of prims in the scene"); - m_log.Notice("load-xml [filename] - load prims from XML"); - m_log.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); - m_log.Notice("permissions [true/false] - turn on/off permissions on the scene"); - m_log.Notice("quit - equivalent to shutdown."); - m_log.Notice("restart - disconnects all clients and restarts the sims in the instance."); - m_log.Notice("remove-region [name] - remove a region"); - m_log.Notice("save-xml [filename] - save prims to XML"); - m_log.Notice("save-xml2 [filename] - save prims to XML using version 2 format"); - m_log.Notice("script - manually trigger scripts? or script commands?"); - m_log.Notice("set-time [x] - set the current scene time phase"); - m_log.Notice("show users - show info about connected users."); - m_log.Notice("show modules - shows info aboutloaded modules."); - m_log.Notice("show stats - statistical information for this server not displayed in the client"); - m_log.Notice("shutdown - disconnect all clients and shutdown."); - m_log.Notice("config set section field value - set a config value"); - m_log.Notice("config get section field - get a config value"); - m_log.Notice("config save - save OpenSim.ini"); - m_log.Notice("terrain help - show help for terrain commands."); + m_console.Notice("alert - send alert to a designated user or all users."); + m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); + m_console.Notice(" alert general [Message] - send an alert to all users."); + m_console.Notice("backup - trigger a simulator backup"); + m_console.Notice("create user - adds a new user"); + m_console.Notice("change-region [name] - sets the region that many of these commands affect."); + m_console.Notice("command-script [filename] - Execute command in a file."); + m_console.Notice("debug - debugging commands"); + m_console.Notice(" packet 0..255 - print incoming/outgoing packets (0=off)"); + m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); + m_console.Notice("export-map [filename] - save image of world map"); + m_console.Notice("force-update - force an update of prims in the scene"); + m_console.Notice("load-xml [filename] - load prims from XML"); + m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); + m_console.Notice("permissions [true/false] - turn on/off permissions on the scene"); + m_console.Notice("quit - equivalent to shutdown."); + m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); + m_console.Notice("remove-region [name] - remove a region"); + m_console.Notice("save-xml [filename] - save prims to XML"); + m_console.Notice("save-xml2 [filename] - save prims to XML using version 2 format"); + m_console.Notice("script - manually trigger scripts? or script commands?"); + m_console.Notice("set-time [x] - set the current scene time phase"); + m_console.Notice("show users - show info about connected users."); + m_console.Notice("show modules - shows info aboutloaded modules."); + m_console.Notice("show stats - statistical information for this server not displayed in the client"); + m_console.Notice("shutdown - disconnect all clients and shutdown."); + m_console.Notice("config set section field value - set a config value"); + m_console.Notice("config get section field - get a config value"); + m_console.Notice("config save - save OpenSim.ini"); + m_console.Notice("terrain help - show help for terrain commands."); break; case "save-xml": @@ -757,8 +740,8 @@ namespace OpenSim { loadOffset.Z = (float) Convert.ToDecimal(cmdparams[4]); } - m_log.Error("loadOffsets = <" + loadOffset.X + "," + loadOffset.Y + "," + - loadOffset.Z + ">"); + m_console.Error("loadOffsets = <" + loadOffset.X + "," + loadOffset.Y + "," + + loadOffset.Z + ">"); } } m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset); @@ -796,7 +779,7 @@ namespace OpenSim if (!m_sceneManager.RunTerrainCmdOnCurrentScene(cmdparams, ref result)) { - m_log.Error(result); + m_console.Error(result); } break; @@ -867,20 +850,18 @@ namespace OpenSim if (!m_sceneManager.TrySetCurrentScene(regionName)) { - m_log.Error("Couldn't set current region to: " + regionName); + m_console.Error("Couldn't set current region to: " + regionName); } } if (m_sceneManager.CurrentScene == null) { - m_log.Notice("CONSOLE", - "Currently at Root level. To change region please use 'change-region '"); + m_console.Error("CONSOLE", "Currently at Root level. To change region please use 'change-region '"); } else { - m_log.Notice("CONSOLE", - "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + - ". To change region please use 'change-region '"); + m_console.Error("CONSOLE", "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + + ". To change region please use 'change-region '"); } break; @@ -905,8 +886,8 @@ namespace OpenSim case "set": if (cmdparams.Length < 4) { - m_log.Notice(n, "SYNTAX: " + n + " SET SECTION KEY VALUE"); - m_log.Notice(n, "EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); + m_console.Error(n, "SYNTAX: " + n + " SET SECTION KEY VALUE"); + m_console.Error(n, "EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); } else { @@ -916,37 +897,35 @@ namespace OpenSim string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3); c.Set(cmdparams[2], _value); m_config.Merge(c.ConfigSource); - - m_log.Notice(n, - n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " + - _value); + + m_console.Error(n, n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " + + _value); } break; case "get": if (cmdparams.Length < 3) { - m_log.Notice(n, "SYNTAX: " + n + " GET SECTION KEY"); - m_log.Notice(n, "EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads"); + m_console.Error(n, "SYNTAX: " + n + " GET SECTION KEY"); + m_console.Error(n, "EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads"); } else { IConfig c = DefaultConfig().Configs[cmdparams[1]]; if (c == null) { - m_log.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist."); + m_console.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist."); break; } else { - m_log.Notice(n, - n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " + - c.GetString(cmdparams[2])); + m_console.Notice(n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " + + c.GetString(cmdparams[2])); } } break; case "save": - m_log.Notice(n, "Saving configuration file: " + Application.iniFilePath); + m_console.Notice("Saving configuration file: " + Application.iniFilePath); m_config.Save(Application.iniFilePath); break; } @@ -957,7 +936,7 @@ namespace OpenSim * Temporarily disabled but it would be good to have this - needs to be levered * in to BaseOpenSimServer (which requires a RunCmd method restrcuture probably) default: - m_log.Error("Unknown command"); + m_console.Error("Unknown command"); break; */ } @@ -973,18 +952,18 @@ namespace OpenSim int newDebug; if (int.TryParse(args[1], out newDebug)) { - m_sceneManager.SetDebugPacketOnCurrentScene(m_log, newDebug); + m_sceneManager.SetDebugPacketOnCurrentScene(newDebug); } else { - m_log.Error("packet debug should be 0..2"); + m_console.Error("packet debug should be 0..2"); } - Console.WriteLine("New packet debug: " + newDebug.ToString()); + m_console.Notice("New packet debug: " + newDebug.ToString()); } break; default: - m_log.Error("Unknown debug"); + m_console.Error("Unknown debug"); break; } } @@ -997,7 +976,7 @@ namespace OpenSim switch (ShowWhat) { case "users": - m_log.Notice( + m_console.Notice( String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}", "Firstname", "Lastname", "Agent ID", "Circuit", "IP", "Region")); @@ -1015,6 +994,7 @@ namespace OpenSim { regionName = regionInfo.RegionName; } + for (int i = 0; i < m_udpServers.Count; i++) { if (m_udpServers[i].RegionHandle == presence.RegionHandle) @@ -1023,7 +1003,8 @@ namespace OpenSim m_udpServers[i].clientCircuits_reverse.TryGetValue(presence.ControllingClient.CircuitCode, out ep); } } - m_log.Notice( + + m_console.Notice( String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}", presence.Firstname, presence.Lastname, @@ -1035,10 +1016,10 @@ namespace OpenSim break; case "modules": - m_log.Notice("The currently loaded shared modules are:"); + m_console.Notice("The currently loaded shared modules are:"); foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) { - m_log.Notice("Shared Module: " + module.Name); + m_console.Notice("Shared Module: " + module.Name); } break; @@ -1046,21 +1027,21 @@ namespace OpenSim m_sceneManager.ForEachScene( delegate(Scene scene) { - m_log.Notice("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " + - scene.RegionInfo.RegionLocX + " , Region YLoc: " + - scene.RegionInfo.RegionLocY); + m_console.Notice("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " + + scene.RegionInfo.RegionLocX + " , Region YLoc: " + + scene.RegionInfo.RegionLocY); }); break; case "stats": if (StatsManager.SimExtraStats != null) { - m_log.Notice( + m_console.Notice( "STATS", Environment.NewLine + StatsManager.SimExtraStats.Report()); } else { - m_log.Notice("STATS", "Extra sim statistics collection has not been enabled"); + m_console.Notice("Extra sim statistics collection has not been enabled"); } break; } diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 5fdb9b3dc5..10bf0d163c 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -51,6 +51,8 @@ namespace OpenSim.Region.ClientStack /// public class ClientView : IClientAPI { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /* static variables */ public static TerrainManager TerrainManager; @@ -196,7 +198,7 @@ namespace OpenSim.Region.ClientStack // m_inventoryCache = inventoryCache; m_authenticateSessionsHandler = authenSessions; - MainLog.Instance.Verbose("CLIENT", "Started up new client thread to handle incoming request"); + m_log.Info("[CLIENT]: Started up new client thread to handle incoming request"); m_agentId = agentId; m_sessionId = sessionId; @@ -260,7 +262,7 @@ namespace OpenSim.Region.ClientStack public void Close(bool ShutdownCircult) { // Pull Client out of Region - MainLog.Instance.Verbose("CLIENT", "Close has been called"); + m_log.Info("[CLIENT]: Close has been called"); //raiseevent on the packet server to Shutdown the circuit if (ShutdownCircult) @@ -286,7 +288,7 @@ namespace OpenSim.Region.ClientStack public void Stop() { - MainLog.Instance.Verbose("BUG", "Stop called, please find out where and remove it"); + m_log.Info("[BUG]: Stop called, please find out where and remove it"); } #endregion @@ -378,7 +380,7 @@ namespace OpenSim.Region.ClientStack protected virtual void ClientLoop() { - MainLog.Instance.Verbose("CLIENT", "Entered loop"); + m_log.Info("[CLIENT]: Entered loop"); while (true) { QueItem nextPacket = m_packetQueue.Dequeue(); @@ -445,7 +447,7 @@ namespace OpenSim.Region.ClientStack m_clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); m_clientPingTimer.Enabled = true; - MainLog.Instance.Verbose("CLIENT", "Adding viewer agent to scene"); + m_log.Info("[CLIENT]: Adding viewer agent to scene"); m_scene.AddNewClient(this, true); } @@ -458,13 +460,13 @@ namespace OpenSim.Region.ClientStack if (!sessionInfo.Authorised) { //session/circuit not authorised - MainLog.Instance.Notice("CLIENT", "New user request denied to " + m_userEndPoint.ToString()); + m_log.Info("[CLIENT]: New user request denied to " + m_userEndPoint.ToString()); m_packetQueue.Close(); m_clientThread.Abort(); } else { - MainLog.Instance.Notice("CLIENT", "Got authenticated connection from " + m_userEndPoint.ToString()); + m_log.Info("[CLIENT]: Got authenticated connection from " + m_userEndPoint.ToString()); //session is authorised m_firstName = sessionInfo.LoginInfo.First; m_lastName = sessionInfo.LoginInfo.Last; @@ -731,7 +733,7 @@ namespace OpenSim.Region.ClientStack } catch (Exception e) { - MainLog.Instance.Warn("client", + m_log.Warn("[client]: " + "ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString()); } } @@ -758,7 +760,7 @@ namespace OpenSim.Region.ClientStack } catch (Exception e) { - MainLog.Instance.Warn("client", + m_log.Warn("[client]: " + "ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString()); } } @@ -2102,7 +2104,7 @@ namespace OpenSim.Region.ClientStack protected virtual bool Logout(IClientAPI client, Packet packet) { - MainLog.Instance.Verbose("CLIENT", "Got a logout request"); + m_log.Info("[CLIENT]: Got a logout request"); if (OnLogout != null) { @@ -2431,10 +2433,10 @@ namespace OpenSim.Region.ClientStack } catch (Exception e) { - MainLog.Instance.Warn("client", + m_log.Warn("[client]: " + "ClientView.m_packetQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + m_userEndPoint.ToString() + " - killing thread"); - MainLog.Instance.Error(e.ToString()); + m_log.Error(e.ToString()); Close(true); } } @@ -2545,7 +2547,7 @@ namespace OpenSim.Region.ClientStack { if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) { - MainLog.Instance.Verbose("NETWORK", "Resending " + packet.Type.ToString() + " packet, " + + m_log.Info("[NETWORK]: Resending " + packet.Type.ToString() + " packet, " + (now - packet.TickCount) + "ms have passed"); packet.Header.Resent = true; @@ -2564,11 +2566,11 @@ namespace OpenSim.Region.ClientStack if (m_pendingAcks.Count > 250) { // FIXME: Handle the odd case where we have too many pending ACKs queued up - MainLog.Instance.Verbose("NETWORK", "Too many ACKs queued up!"); + m_log.Info("[NETWORK]: Too many ACKs queued up!"); return; } - //MainLog.Instance.Verbose("NETWORK", "Sending PacketAck"); + //m_log.Info("[NETWORK]: Sending PacketAck"); int i = 0; PacketAckPacket acks = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck); @@ -2754,7 +2756,7 @@ namespace OpenSim.Region.ClientStack //rezPacket.RezData.RemoveItem; //rezPacket.RezData.RezSelected; //rezPacket.RezData.FromTaskID; - //MainLog.Instance.Verbose("REZData", rezPacket.ToString()); + //m_log.Info("[REZData]: " + rezPacket.ToString()); OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID, rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection, @@ -2772,7 +2774,7 @@ namespace OpenSim.Region.ClientStack break; case PacketType.ModifyLand: ModifyLandPacket modify = (ModifyLandPacket)Pack; - //MainLog.Instance.Verbose("LAND", "LAND:" + modify.ToString()); + //m_log.Info("[LAND]: LAND:" + modify.ToString()); if (modify.ParcelData.Length > 0) { if (OnModifyTerrain != null) @@ -2941,7 +2943,7 @@ namespace OpenSim.Region.ClientStack { ObjectAddPacket addPacket = (ObjectAddPacket)Pack; PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); - // MainLog.Instance.Verbose("REZData", addPacket.ToString()); + // m_log.Info("[REZData]: " + addPacket.ToString()); //BypassRaycast: 1 //RayStart: <69.79469, 158.2652, 98.40343> //RayEnd: <61.97724, 141.995, 92.58341> @@ -3068,7 +3070,7 @@ namespace OpenSim.Region.ClientStack } break; case PacketType.ObjectPermissions: - MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString()); + m_log.Warn("[CLIENT]: unhandled packet " + PacketType.ObjectPermissions.ToString()); ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack; List permChanges = @@ -3344,7 +3346,7 @@ namespace OpenSim.Region.ClientStack } break; case PacketType.MoveTaskInventory: - MainLog.Instance.Warn("CLIENT", "unhandled MoveTaskInventory packet"); + m_log.Warn("[CLIENT]: unhandled MoveTaskInventory packet"); break; case PacketType.RezScript: //Console.WriteLine(Pack.ToString()); @@ -3594,7 +3596,7 @@ namespace OpenSim.Region.ClientStack break; case PacketType.GodKickUser: - MainLog.Instance.Warn("CLIENT", "unhandled GodKickUser packet"); + m_log.Warn("[CLIENT]: unhandled GodKickUser packet"); GodKickUserPacket gkupack = (GodKickUserPacket)Pack; @@ -3624,88 +3626,88 @@ namespace OpenSim.Region.ClientStack // Send the client the ping response back // Pass the same PingID in the matching packet // Handled In the packet processing - //MainLog.Instance.Debug("CLIENT", "possibly unhandled StartPingCheck packet"); + //m_log.Debug("[CLIENT]: possibly unhandled StartPingCheck packet"); break; case PacketType.CompletePingCheck: // TODO: Perhaps this should be processed on the Sim to determine whether or not to drop a dead client - //MainLog.Instance.Warn("CLIENT", "unhandled CompletePingCheck packet"); + //m_log.Warn("[CLIENT]: unhandled CompletePingCheck packet"); break; case PacketType.ObjectScale: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled ObjectScale packet"); + m_log.Warn("[CLIENT]: unhandled ObjectScale packet"); break; case PacketType.ViewerStats: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled ViewerStats packet"); + m_log.Warn("[CLIENT]: unhandled ViewerStats packet"); break; case PacketType.CreateGroupRequest: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled CreateGroupRequest packet"); + m_log.Warn("[CLIENT]: unhandled CreateGroupRequest packet"); break; case PacketType.GenericMessage: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled GenericMessage packet"); + m_log.Warn("[CLIENT]: unhandled GenericMessage packet"); break; case PacketType.MapItemRequest: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled MapItemRequest packet"); + m_log.Warn("[CLIENT]: unhandled MapItemRequest packet"); break; case PacketType.AgentResume: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled AgentResume packet"); + m_log.Warn("[CLIENT]: unhandled AgentResume packet"); break; case PacketType.AgentPause: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled AgentPause packet"); + m_log.Warn("[CLIENT]: unhandled AgentPause packet"); break; case PacketType.TransferAbort: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled TransferAbort packet"); + m_log.Warn("[CLIENT]: unhandled TransferAbort packet"); break; case PacketType.MuteListRequest: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled MuteListRequest packet"); + m_log.Warn("[CLIENT]: unhandled MuteListRequest packet"); break; case PacketType.AgentDataUpdateRequest: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled AgentDataUpdateRequest packet"); + m_log.Warn("[CLIENT]: unhandled AgentDataUpdateRequest packet"); break; case PacketType.ParcelDwellRequest: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled ParcelDwellRequest packet"); + m_log.Warn("[CLIENT]: unhandled ParcelDwellRequest packet"); break; case PacketType.UseCircuitCode: // TODO: handle this packet - //MainLog.Instance.Warn("CLIENT", "unhandled UseCircuitCode packet"); + //m_log.Warn("[CLIENT]: unhandled UseCircuitCode packet"); break; case PacketType.EconomyDataRequest: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled EconomyDataRequest packet"); + m_log.Warn("[CLIENT]: unhandled EconomyDataRequest packet"); break; case PacketType.AgentHeightWidth: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled AgentHeightWidth packet"); + m_log.Warn("[CLIENT]: unhandled AgentHeightWidth packet"); break; case PacketType.ObjectSpinStop: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled ObjectSpinStop packet"); + m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); break; case PacketType.SoundTrigger: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled SoundTrigger packet"); + m_log.Warn("[CLIENT]: unhandled SoundTrigger packet"); break; case PacketType.UserInfoRequest: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled UserInfoRequest packet"); + m_log.Warn("[CLIENT]: unhandled UserInfoRequest packet"); break; case PacketType.InventoryDescendents: // TODO: handle this packet - MainLog.Instance.Warn("CLIENT", "unhandled InventoryDescent packet"); + m_log.Warn("[CLIENT]: unhandled InventoryDescent packet"); break; default: - MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString()); + m_log.Warn("[CLIENT]: unhandled packet " + Pack.ToString()); break; #endregion diff --git a/OpenSim/Region/ClientStack/PacketQueue.cs b/OpenSim/Region/ClientStack/PacketQueue.cs index 685f91b97a..8b2a93a7ca 100644 --- a/OpenSim/Region/ClientStack/PacketQueue.cs +++ b/OpenSim/Region/ClientStack/PacketQueue.cs @@ -37,6 +37,8 @@ namespace OpenSim.Region.ClientStack { public class PacketQueue { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private bool m_enabled = true; private BlockingQueue SendQueue; @@ -204,7 +206,7 @@ namespace OpenSim.Region.ClientStack SendQueue.Enqueue(AssetOutgoingPacketQueue.Dequeue()); } } - // MainLog.Instance.Verbose("THROTTLE", "Processed " + throttleLoops + " packets"); + // m_log.Info("[THROTTLE]: Processed " + throttleLoops + " packets"); } } @@ -253,7 +255,7 @@ namespace OpenSim.Region.ClientStack lock (this) { ResetCounters(); - // MainLog.Instance.Verbose("THROTTLE", "Entering Throttle"); + // m_log.Info("[THROTTLE]: Entering Throttle"); while (TotalThrottle.UnderLimit() && PacketsWaiting() && (throttleLoops <= MaxThrottleLoops)) { @@ -316,7 +318,7 @@ namespace OpenSim.Region.ClientStack AssetThrottle.Add(qpack.Packet.ToBytes().Length); } } - // MainLog.Instance.Verbose("THROTTLE", "Processed " + throttleLoops + " packets"); + // m_log.Info("[THROTTLE]: Processed " + throttleLoops + " packets"); } } @@ -426,7 +428,7 @@ namespace OpenSim.Region.ClientStack tall = tResend + tLand + tWind + tCloud + tTask + tTexture + tAsset; /* - MainLog.Instance.Verbose("CLIENT", "Client AgentThrottle - Got throttle:resendbytes=" + tResend + + m_log.Info("[CLIENT]: Client AgentThrottle - Got throttle:resendbytes=" + tResend + " landbytes=" + tLand + " windbytes=" + tWind + " cloudbytes=" + tCloud + diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 72917d1b7f..8a042b10db 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -42,6 +42,8 @@ namespace OpenSim.Region.ClientStack { public abstract class RegionApplicationBase : BaseOpenSimServer { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected AssetCache m_assetCache; protected Dictionary m_clientCircuits = new Dictionary(); protected NetworkServersInfo m_networkServersInfo; @@ -75,19 +77,20 @@ namespace OpenSim.Region.ClientStack m_httpServer = new BaseHttpServer(m_httpServerPort); - m_log.Status("REGION", "Starting HTTP server"); + m_log.Info("[REGION]: Starting HTTP server"); + m_httpServer.Start(); } protected abstract void Initialize(); - protected void StartLog() + protected void StartConsole() { - m_log = CreateLog(); - MainLog.Instance = m_log; + m_console = CreateConsole(); + MainConsole.Instance = m_console; } - protected abstract LogBase CreateLog(); + protected abstract ConsoleBase CreateConsole(); protected abstract PhysicsScene GetPhysicsScene(); protected abstract StorageManager CreateStorageManager(string connectionstring); @@ -107,7 +110,7 @@ namespace OpenSim.Region.ClientStack // listenIP = IPAddress.Parse("0.0.0.0"); uint port = (uint) regionInfo.InternalEndPoint.Port; - udpServer = new UDPServer(listenIP, ref port, regionInfo.m_allow_alternate_ports, m_assetCache, m_log, circuitManager); + udpServer = new UDPServer(listenIP, ref port, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager); regionInfo.InternalEndPoint.Port = (int)port; Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); @@ -136,12 +139,12 @@ namespace OpenSim.Region.ClientStack if (masterAvatar != null) { - m_log.Verbose("PARCEL", "Found master avatar [" + masterAvatar.UUID.ToString() + "]"); + m_log.Info("[PARCEL]: Found master avatar [" + masterAvatar.UUID.ToString() + "]"); scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID; } else { - m_log.Verbose("PARCEL", "No master avatar found, using null."); + m_log.Info("[PARCEL]: No master avatar found, using null."); scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero; } diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 3e2b53611a..f9918fff26 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs @@ -39,6 +39,8 @@ namespace OpenSim.Region.ClientStack { public class UDPServer : ClientStackNetworkHandler { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected Dictionary clientCircuits = new Dictionary(); public Dictionary clientCircuits_reverse = new Dictionary(); public Socket Server; @@ -56,7 +58,6 @@ namespace OpenSim.Region.ClientStack protected IPAddress listenIP = IPAddress.Parse("0.0.0.0"); protected IScene m_localScene; protected AssetCache m_assetCache; - protected LogBase m_log; protected AgentCircuitManager m_authenticateSessionsClass; public PacketServer PacketServer @@ -84,13 +85,12 @@ namespace OpenSim.Region.ClientStack { } - public UDPServer(IPAddress _listenIP, ref uint port, bool allow_alternate_port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass) + public UDPServer(IPAddress _listenIP, ref uint port, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass) { listenIP = _listenIP; listenPort = port; Allow_Alternate_Port = allow_alternate_port; m_assetCache = assetCache; - m_log = console; m_authenticateSessionsClass = authenticateClass; CreatePacketServer(); @@ -121,7 +121,7 @@ namespace OpenSim.Region.ClientStack { // TODO : Actually only handle those states that we have control over, re-throw everything else, // TODO: implement cases as we encounter them. - //m_log.Error("UDPSERVER", "Connection Error! - " + e.ToString()); + //m_log.Error("[UDPSERVER]: Connection Error! - " + e.ToString()); switch (e.SocketErrorCode) { case SocketError.AlreadyInProgress: @@ -134,7 +134,7 @@ namespace OpenSim.Region.ClientStack } catch (Exception a) { - MainLog.Instance.Verbose("UDPSERVER", a.ToString()); + m_log.Info("[UDPSERVER]: " + a.ToString()); } try { @@ -159,7 +159,7 @@ namespace OpenSim.Region.ClientStack } catch (Exception) { - //MainLog.Instance.Verbose("UDPSERVER", a.ToString()); + //m_log.Info("[UDPSERVER]" + a.ToString()); } try { @@ -191,8 +191,7 @@ namespace OpenSim.Region.ClientStack } catch (ObjectDisposedException) { - - //MainLog.Instance.Debug("UDPSERVER", e.ToString()); + //m_log.Debug("[UDPSERVER]: " + e.ToString()); return; } @@ -214,20 +213,20 @@ namespace OpenSim.Region.ClientStack if (clientCircuits.TryGetValue(epSender, out circuit)) { //if so then send packet to the packetserver - //MainLog.Instance.Warn("UDPSERVER", "ALREADY HAVE Circuit!"); + //m_log.Warn("[UDPSERVER]: ALREADY HAVE Circuit!"); m_packetServer.InPacket(circuit, packet); } else if (packet.Type == PacketType.UseCircuitCode) { // new client - MainLog.Instance.Debug("UDPSERVER", "Adding New Client"); + m_log.Debug("[UDPSERVER]: Adding New Client"); AddNewClient(packet); } else { // invalid client //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now - //m_log.Warn("UDPSERVER", "Got a packet from an invalid client - " + packet.ToString()); + //m_log.Warn("[UDPSERVER]: Got a packet from an invalid client - " + packet.ToString()); } } @@ -255,12 +254,11 @@ namespace OpenSim.Region.ClientStack public void ServerListener() { - uint newPort = listenPort; for (uint i = 0; i < 20; i++) { newPort = listenPort + i; - m_log.Verbose("SERVER", "Opening UDP socket on " + listenIP.ToString() + " " + newPort + ".");// Allow alternate ports: " + Allow_Alternate_Port.ToString()); + m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + ".");// Allow alternate ports: " + Allow_Alternate_Port.ToString()); try { ServerIncoming = new IPEndPoint(listenIP, (int) newPort); @@ -276,19 +274,19 @@ namespace OpenSim.Region.ClientStack throw (ex); // We are looking for alternate ports! - m_log.Verbose("SERVER", "UDP socket on " + listenIP.ToString() + " " + listenPort.ToString() + " is not available, trying next."); + m_log.Info("[SERVER]: UDP socket on " + listenIP.ToString() + " " + listenPort.ToString() + " is not available, trying next."); } System.Threading.Thread.Sleep(100); // Wait before we retry socket } - m_log.Verbose("SERVER", "UDP socket bound, getting ready to listen"); + m_log.Info("[SERVER]: UDP socket bound, getting ready to listen"); ipeSender = new IPEndPoint(listenIP, 0); epSender = (EndPoint) ipeSender; ReceivedData = new AsyncCallback(OnReceivedData); Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); - m_log.Status("SERVER", "Listening on port " + newPort); + m_log.Info("[SERVER]: Listening on port " + newPort); } public virtual void RegisterPacketServer(PacketServer server) diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 25452c13ac..98419ab29f 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -36,6 +36,8 @@ namespace OpenSim.Region.Communications.Local { public class LocalBackEndServices : IGridServices, IInterRegionCommunications { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected Dictionary m_regions = new Dictionary(); protected Dictionary m_regionListeners = @@ -93,8 +95,9 @@ namespace OpenSim.Region.Communications.Local RegionCommsListener regionHost = new RegionCommsListener(); if (m_regionListeners.ContainsKey(regionInfo.RegionHandle)) { - MainLog.Instance.Error("INTERREGION", - "Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up."); + m_log.Error("[INTERREGION]: " + + "Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. " + + "In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up."); m_regionListeners.Remove(regionInfo.RegionHandle); } m_regionListeners.Add(regionInfo.RegionHandle, regionHost); @@ -105,7 +108,7 @@ namespace OpenSim.Region.Communications.Local { // Already in our list, so the region went dead and restarted. m_regions.Remove(regionInfo.RegionHandle); - MainLog.Instance.Warn("INTERREGION", "Region registered twice. Region went down and came back up."); + m_log.Warn("[INTERREGION]: Region registered twice. Region went down and came back up."); RegionCommsListener regionHost = new RegionCommsListener(); if (m_regionListeners.ContainsKey(regionInfo.RegionHandle)) @@ -229,7 +232,7 @@ namespace OpenSim.Region.Communications.Local { // Console.WriteLine("CommsManager- Informing a region to expect child agent"); m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle, cAgentData); - //MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname); + //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname); return true; } @@ -292,13 +295,13 @@ namespace OpenSim.Region.Communications.Local //should change from agentCircuitData { //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); - //MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname); + //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname); if (m_regionListeners.ContainsKey(regionHandle)) { // Console.WriteLine("CommsManager- Informing a region to expect child agent"); m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData); - //MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname); + //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname); return true; } @@ -389,11 +392,11 @@ namespace OpenSim.Region.Communications.Local public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) { - //MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other region is sending child agent our way: " + agent.firstname + " " + agent.lastname); + //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Other region is sending child agent our way: " + agent.firstname + " " + agent.lastname); if (m_regionListeners.ContainsKey(regionHandle)) { - //MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname); + //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname); m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent); } @@ -443,11 +446,11 @@ namespace OpenSim.Region.Communications.Local public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) { - // MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname); + // m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname); if (m_regionListeners.ContainsKey(regionHandle)) { - //MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: found local region to trigger event on: " + agentData.firstname + " " + agentData.lastname); + //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: found local region to trigger event on: " + agentData.firstname + " " + agentData.lastname); TriggerExpectUser(regionHandle, agentData); return true; diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 2848b8a9d6..f6dd379cff 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -44,6 +44,8 @@ namespace OpenSim.Region.Communications.Local public class LocalLoginService : LoginService { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private CommunicationsLocal m_Parent; private NetworkServersInfo serversInfo; @@ -77,7 +79,7 @@ namespace OpenSim.Region.Communications.Local if (!authUsers) { //no current user account so make one - MainLog.Instance.Notice("LOGIN", "No user account found so creating a new one."); + m_log.Info("[LOGIN]: No user account found so creating a new one."); m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); @@ -97,14 +99,14 @@ namespace OpenSim.Region.Communications.Local if (!authUsers) { //for now we will accept any password in sandbox mode - MainLog.Instance.Notice("LOGIN", "Authorising user (no actual password check)"); + m_log.Info("[LOGIN]: Authorising user (no actual password check)"); return true; } else { - MainLog.Instance.Notice( - "LOGIN", "Authenticating " + profile.username + " " + profile.surname); + m_log.Info( + "[LOGIN]: Authenticating " + profile.username + " " + profile.surname); if (!password.StartsWith("$1$")) password = "$1$" + Util.Md5Hash(password); @@ -166,7 +168,7 @@ namespace OpenSim.Region.Communications.Local } else { - MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion); + m_log.Warn("[LOGIN]: Not found region " + currentRegion); } } private LoginResponse.BuddyList ConvertFriendListItem(List LFL) diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 1576bf326b..f04574a4f6 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -47,6 +47,8 @@ namespace OpenSim.Region.Communications.OGS1 { public class OGS1GridServices : IGridServices, IInterRegionCommunications { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private LocalBackEndServices m_localBackend = new LocalBackEndServices(); private Dictionary m_remoteRegionInfoCache = new Dictionary(); private List m_knownRegions = new List(); @@ -138,7 +140,7 @@ namespace OpenSim.Region.Communications.OGS1 GridResp = GridReq.Send(serversInfo.GridURL, 10000); } catch (Exception ex) { - MainLog.Instance.Error("Unable to connect to grid. Grid server not running?"); + m_log.Error("Unable to connect to grid. Grid server not running?"); throw(ex); } Hashtable GridRespData = (Hashtable)GridResp.Value; @@ -148,7 +150,7 @@ namespace OpenSim.Region.Communications.OGS1 if (GridRespData.ContainsKey("error")) { string errorstring = (string) GridRespData["error"]; - MainLog.Instance.Error("Unable to connect to grid: " + errorstring); + m_log.Error("Unable to connect to grid: " + errorstring); return null; } else @@ -330,9 +332,9 @@ namespace OpenSim.Region.Communications.OGS1 } catch (WebException) { - MainLog.Instance.Error("GRID", - "Region lookup failed for: " + regionHandle.ToString() + - " - Is the GridServer down?"); + m_log.Error("[GRID]: " + + "Region lookup failed for: " + regionHandle.ToString() + + " - Is the GridServer down?"); return null; } } @@ -421,7 +423,7 @@ namespace OpenSim.Region.Communications.OGS1 } catch (Exception e) { - MainLog.Instance.Error("MapBlockQuery XMLRPC failure: " + e.ToString()); + m_log.Error("MapBlockQuery XMLRPC failure: " + e.ToString()); return new Hashtable(); } } @@ -482,7 +484,7 @@ namespace OpenSim.Region.Communications.OGS1 m_localBackend.TriggerExpectUser(regionHandle, agentData); - MainLog.Instance.Verbose("GRID", "Welcoming new user..."); + m_log.Info("[GRID]: Welcoming new user..."); return new XmlRpcResponse(); } @@ -555,7 +557,7 @@ namespace OpenSim.Region.Communications.OGS1 Console.WriteLine("remoting object not found"); } remObject = null; - //MainLog.Instance.Verbose("INTER", + //m_log.Info("[INTER]: " + //gdebugRegionName + //": OGS1 tried to Update Child Agent data on outside region and got " + //retValue.ToString()); @@ -569,45 +571,45 @@ namespace OpenSim.Region.Communications.OGS1 catch (RemotingException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (SocketException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + " " + + m_log.Warn("Socket Error: Unable to connect to adjacent region: " + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (InvalidCredentialException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + + m_log.Warn("Invalid Credentials: Unable to connect to adjacent region: " + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (AuthenticationException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + + m_log.Warn("Authentication exception: Unable to connect to adjacent region: " + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (Exception e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } } else { - //MainLog.Instance.Verbose("INTERREGION", "Skipped Sending Child Update to a region because it failed too many times:" + regionHandle.ToString()); + //m_log.Info("[INTERREGION]: Skipped Sending Child Update to a region because it failed too many times:" + regionHandle.ToString()); return false; } } @@ -650,10 +652,10 @@ namespace OpenSim.Region.Communications.OGS1 Console.WriteLine("remoting object not found"); } remObject = null; - MainLog.Instance.Verbose("INTER", - gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + - agentData.firstname + " " + agentData.lastname + " and got " + - retValue.ToString()); + m_log.Info("[INTER]: " + + gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + + agentData.firstname + " " + agentData.lastname + " and got " + + retValue.ToString()); return retValue; @@ -664,41 +666,41 @@ namespace OpenSim.Region.Communications.OGS1 catch (RemotingException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); return false; } catch (SocketException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + + m_log.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (InvalidCredentialException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + + m_log.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (AuthenticationException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + + m_log.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (Exception e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + + m_log.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } } @@ -748,7 +750,7 @@ namespace OpenSim.Region.Communications.OGS1 Console.WriteLine("remoting object not found"); } remObject = null; - MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to inform region I'm up"); + m_log.Info("[INTER]: " + gdebugRegionName + ": OGS1 tried to inform region I'm up"); return retValue; } @@ -765,49 +767,49 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region using tcp://" + - regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + - " - Is this neighbor up?"); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Remoting Error: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + + " - Is this neighbor up?"); + m_log.Debug(e.ToString()); return false; } catch (SocketException e) { - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + - regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + - " - Is this neighbor up?"); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + + " - Is this neighbor up?"); + m_log.Debug(e.ToString()); return false; } catch (InvalidCredentialException e) { - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + - regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); return false; } catch (AuthenticationException e) { - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + - regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); return false; } catch (Exception e) { // This line errors with a Null Reference Exception.. Why? @.@ - //MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + + //m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + // ":" + regInfo.RemotingPort + //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } } @@ -860,41 +862,41 @@ namespace OpenSim.Region.Communications.OGS1 catch (RemotingException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); return false; } catch (SocketException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + - regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); return false; } catch (InvalidCredentialException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); return false; } catch (AuthenticationException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + - regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Authentication exception: Unable to connect to adjacent region: " + + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); return false; } catch (Exception e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); return false; } } @@ -947,9 +949,9 @@ namespace OpenSim.Region.Communications.OGS1 catch (RemotingException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); return false; } catch @@ -1000,9 +1002,9 @@ namespace OpenSim.Region.Communications.OGS1 catch (RemotingException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); return false; } catch @@ -1052,61 +1054,61 @@ namespace OpenSim.Region.Communications.OGS1 catch (RemotingException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName + + m_log.Warn("Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - //MainLog.Instance.Debug(e.ToString()); + //m_log.Debug(e.ToString()); return false; } catch (SocketException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + + m_log.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - Is this neighbor up?"); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (InvalidCredentialException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + + m_log.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (AuthenticationException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + + m_log.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (WebException e) { NoteDeadRegion(regionHandle); - MainLog.Instance.Warn("WebException exception: Unable to connect to adjacent region using tcp://" + + m_log.Warn("WebException exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } catch (Exception e) { NoteDeadRegion(regionHandle); // This line errors with a Null Reference Exception.. Why? @.@ - //MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + + //m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + // ":" + regInfo.RemotingPort + //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); - MainLog.Instance.Debug(e.ToString()); + m_log.Debug(e.ToString()); return false; } } @@ -1133,7 +1135,7 @@ namespace OpenSim.Region.Communications.OGS1 /// public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) { - //MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname); + //m_log.Info("[INTER]: " + gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname); try { @@ -1141,16 +1143,16 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException) { - //MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + //m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); return false; } } public bool TriggerRegionUp(SearializableRegionInfo regionData, ulong regionhandle) { - MainLog.Instance.Verbose("INTER", - gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX + - "," + regionData.RegionLocY + "). Giving this region a fresh set of 'dead' tries"); + m_log.Info("[INTER]: " + + gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX + + "," + regionData.RegionLocY + "). Giving this region a fresh set of 'dead' tries"); try { @@ -1169,14 +1171,14 @@ namespace OpenSim.Region.Communications.OGS1 catch (RemotingException e) { - MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); return false; } } public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) { - //MainLog.Instance.Verbose("INTER", "Incoming OGS1 Child Agent Data Update"); + //m_log.Info("[INTER]: Incoming OGS1 Child Agent Data Update"); try { @@ -1184,7 +1186,7 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); return false; } } @@ -1206,7 +1208,7 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); return false; } } @@ -1226,7 +1228,7 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); return false; } } @@ -1239,7 +1241,7 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); return false; } } @@ -1252,7 +1254,7 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException) { - MainLog.Instance.Verbose("INTERREGION", "Remoting Error: Unable to connect to neighbour to tell it to close a child connection"); + m_log.Info("[INTERREGION]: Remoting Error: Unable to connect to neighbour to tell it to close a child connection"); return false; } diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index b39e0b7f30..217bb81a82 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs @@ -141,6 +141,8 @@ namespace OpenSim.Region.Communications.OGS1 public class OGS1InterRegionRemoting : MarshalByRefObject { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public OGS1InterRegionRemoting() { } @@ -230,18 +232,18 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } + public bool TellRegionToCloseChildConnection(ulong regionHandle, Guid agentID) { try { return InterRegionSingleton.Instance.TellRegionToCloseChildConnection(regionHandle, new LLUUID(agentID)); - } catch (RemotingException) { - OpenSim.Framework.Console.MainLog.Instance.Verbose("INTERREGION", "Remoting Error: Unable to connect to remote region: " + regionHandle.ToString()); + m_log.Info("[INTERREGION]: Remoting Error: Unable to connect to remote region: " + regionHandle.ToString()); return false; } } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 17807079db..656dd70a78 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -38,6 +38,8 @@ namespace OpenSim.Region.Communications.OGS1 { public class OGS1InventoryService : IInventoryServices { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private string _inventoryServerUrl; private Dictionary m_RequestingInventory = new Dictionary(); @@ -71,9 +73,9 @@ namespace OpenSim.Region.Communications.OGS1 { try { - MainLog.Instance.Verbose( - "INVENTORY", "Requesting inventory from {0}/GetInventory/ for user {1}", - _inventoryServerUrl, userID); + m_log.Info( + String.Format("[INVENTORY]: Requesting inventory from {0}/GetInventory/ for user {1}", + _inventoryServerUrl, userID)); RestObjectPosterResponse requester = new RestObjectPosterResponse(); @@ -83,7 +85,7 @@ namespace OpenSim.Region.Communications.OGS1 } catch (Exception e) { - MainLog.Instance.Error("INVENTORY", e.ToString()); + m_log.Error("[INVENTORY]: " + e.ToString()); } } @@ -96,9 +98,9 @@ namespace OpenSim.Region.Communications.OGS1 LLUUID userID = response.UserID; if (m_RequestingInventory.ContainsKey(userID)) { - MainLog.Instance.Verbose("INVENTORY", + m_log.Info(String.Format("[INVENTORY]: " + "Received inventory response for user {0} containing {1} folders and {2} items", - userID, response.Folders.Count, response.AllItems.Count); + userID, response.Folders.Count, response.AllItems.Count)); InventoryFolderImpl rootFolder = null; InventoryRequest request = m_RequestingInventory[userID]; @@ -132,10 +134,10 @@ namespace OpenSim.Region.Communications.OGS1 } else { - MainLog.Instance.Warn( - "INVENTORY", - "Received inventory response for {0} for which we do not have a record of requesting!", - userID); + m_log.Warn( + String.Format("[INVENTORY]: " + + "Received inventory response for {0} for which we do not have a record of requesting!", + userID)); } } @@ -198,4 +200,4 @@ namespace OpenSim.Region.Communications.OGS1 } } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 70b7e89481..9a22d14183 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -40,6 +40,8 @@ namespace OpenSim.Region.Communications.OGS1 { public class OGS1UserServices : IUserService { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private CommunicationsOGS1 m_parent; public OGS1UserServices(CommunicationsOGS1 parent) @@ -51,10 +53,10 @@ namespace OpenSim.Region.Communications.OGS1 { if (data.Contains("error_type")) { - MainLog.Instance.Warn("GRID", - "Error sent by user server when trying to get user profile: (" + - data["error_type"] + - "): " + data["error_desc"]); + m_log.Warn("[GRID]: " + + "Error sent by user server when trying to get user profile: (" + + data["error_type"] + + "): " + data["error_desc"]); return null; } @@ -104,7 +106,7 @@ namespace OpenSim.Region.Communications.OGS1 } else { - MainLog.Instance.Warn("INTERGRID", "Got invalid queryID from userServer"); + m_log.Warn("[INTERGRID]: Got invalid queryID from userServer"); } return pickerlist; } @@ -158,7 +160,7 @@ namespace OpenSim.Region.Communications.OGS1 } catch (System.Net.WebException) { - MainLog.Instance.Warn("LOGOFF", "Unable to notify grid server of user logoff"); + m_log.Warn("[LOGOFF]: Unable to notify grid server of user logoff"); } @@ -186,8 +188,8 @@ namespace OpenSim.Region.Communications.OGS1 } catch (WebException e) { - MainLog.Instance.Warn("Error when trying to fetch Avatar Picker Response: " + - e.Message); + m_log.Warn("Error when trying to fetch Avatar Picker Response: " + + e.Message); // Return Empty picker list (no results) } return pickerlist; @@ -209,8 +211,8 @@ namespace OpenSim.Region.Communications.OGS1 } catch (WebException e) { - MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " + - e.Message); + m_log.Warn("Error when trying to fetch profile data by name from remote user server: " + + e.Message); } return null; } @@ -299,24 +301,24 @@ namespace OpenSim.Region.Communications.OGS1 } else { - MainLog.Instance.Warn("GRID", "Unable to add new friend, User Server Reported an issue"); + m_log.Warn("[GRID]: Unable to add new friend, User Server Reported an issue"); } } else { - MainLog.Instance.Warn("GRID", "Unable to add new friend, UserServer didn't understand me!"); + m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!"); } } else { - MainLog.Instance.Warn("GRID", "Unable to add new friend, UserServer didn't understand me!"); + m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!"); } } catch (WebException e) { - MainLog.Instance.Warn("GRID","Error when trying to AddNewUserFriend: " + - e.Message); + m_log.Warn("[GRID]: Error when trying to AddNewUserFriend: " + + e.Message); } @@ -352,24 +354,24 @@ namespace OpenSim.Region.Communications.OGS1 } else { - MainLog.Instance.Warn("GRID", "Unable to remove friend, User Server Reported an issue"); + m_log.Warn("[GRID]: Unable to remove friend, User Server Reported an issue"); } } else { - MainLog.Instance.Warn("GRID", "Unable to remove friend, UserServer didn't understand me!"); + m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!"); } } else { - MainLog.Instance.Warn("GRID", "Unable to remove friend, UserServer didn't understand me!"); + m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!"); } } catch (WebException e) { - MainLog.Instance.Warn("GRID", "Error when trying to RemoveUserFriend: " + - e.Message); + m_log.Warn("[GRID]: Error when trying to RemoveUserFriend: " + + e.Message); } } @@ -404,25 +406,24 @@ namespace OpenSim.Region.Communications.OGS1 } else { - MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, User Server Reported an issue"); + m_log.Warn("[GRID]: Unable to update_user_friend_perms, User Server Reported an issue"); } } else { - MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, UserServer didn't understand me!"); + m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!"); } } else { - MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, UserServer didn't understand me!"); + m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!"); } } catch (WebException e) { - MainLog.Instance.Warn("GRID", "Error when trying to update_user_friend_perms: " + - e.Message); - + m_log.Warn("[GRID]: Error when trying to update_user_friend_perms: " + + e.Message); } } /// @@ -452,14 +453,13 @@ namespace OpenSim.Region.Communications.OGS1 } catch (WebException e) { - MainLog.Instance.Warn("Error when trying to fetch Avatar's friends list: " + - e.Message); + m_log.Warn("Error when trying to fetch Avatar's friends list: " + + e.Message); // Return Empty list (no friends) } return buddylist; - } #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs index edc86e58ab..860bd93979 100644 --- a/OpenSim/Region/Environment/EstateManager.cs +++ b/OpenSim/Region/Environment/EstateManager.cs @@ -41,6 +41,8 @@ namespace OpenSim.Region.Environment /// public class EstateManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; private RegionInfo m_regInfo; @@ -156,7 +158,7 @@ namespace OpenSim.Region.Environment { case "getinfo": - //MainLog.Instance.Verbose("ESTATE","CLIENT--->" + packet.ToString()); + //m_log.Info("[ESTATE]: CLIENT--->" + packet.ToString()); sendRegionInfoPacketToAll(); if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId)) { @@ -223,7 +225,7 @@ namespace OpenSim.Region.Environment } break; default: - MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); + m_log.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); break; } } @@ -283,7 +285,7 @@ namespace OpenSim.Region.Environment returnblock[8].Parameter = Helpers.StringToField("1"); packet.ParamList = returnblock; - //MainLog.Instance.Verbose("ESTATE", "SIM--->" + packet.ToString()); + //m_log.Info("[ESTATE]: SIM--->" + packet.ToString()); remote_client.OutPacket(packet, ThrottleOutPacketType.Task); sendEstateManagerList(remote_client, packet); @@ -322,7 +324,7 @@ namespace OpenSim.Region.Environment returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++; } packet.ParamList = returnblock; - //MainLog.Instance.Verbose("ESTATE", "SIM--->" + packet.ToString()); + //m_log.Info("[ESTATE]: SIM--->" + packet.ToString()); remote_client.OutPacket(packet, ThrottleOutPacketType.Task); } @@ -364,10 +366,10 @@ namespace OpenSim.Region.Environment default: - MainLog.Instance.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta\n" + packet.ToString()); + m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta\n" + packet.ToString()); break; } - //MainLog.Instance.Error("EstateOwnerMessage: estateAccessDelta\n" + packet.ToString()); + //m_log.Error("EstateOwnerMessage: estateAccessDelta\n" + packet.ToString()); } @@ -375,7 +377,7 @@ namespace OpenSim.Region.Environment { if (packet.ParamList.Length != 9) { - MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); + m_log.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); } else { @@ -438,7 +440,7 @@ namespace OpenSim.Region.Environment { if (packet.ParamList.Length != 9) { - MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); + m_log.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); } else { @@ -463,7 +465,7 @@ namespace OpenSim.Region.Environment } catch (Exception ex) { - MainLog.Instance.Error("EstateManager: Exception while setting terrain settings: \n" + packet.ToString() + "\n" + ex.ToString()); + m_log.Error("EstateManager: Exception while setting terrain settings: \n" + packet.ToString() + "\n" + ex.ToString()); } } } diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index c0c1b7319d..09fa09b70f 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.Collections.Generic; using Axiom.Math; @@ -38,7 +39,6 @@ using OpenSim.Region.Physics.Manager; namespace OpenSim.Region.Environment.LandManagement { - #region LandManager Class /// @@ -46,6 +46,8 @@ namespace OpenSim.Region.Environment.LandManagement /// public class LandManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + #region Constants //Land types set with flags in ParcelOverlay. @@ -57,7 +59,6 @@ namespace OpenSim.Region.Environment.LandManagement public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100 public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101 - //Flags that when set, a border on the given side will be placed //NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc) //This took forever to figure out -- jeesh. /blame LL for even having to send these @@ -73,7 +74,6 @@ namespace OpenSim.Region.Environment.LandManagement public const int LAND_SELECT_OBJECTS_GROUP = 4; public const int LAND_SELECT_OBJECTS_OTHER = 8; - //These are other constants. Yay! public const int START_LAND_LOCAL_ID = 1; @@ -127,7 +127,7 @@ namespace OpenSim.Region.Environment.LandManagement //} //catch (Exception ex) //{ - //MainLog.Instance.Error("LandManager", "IncomingLandObjectsFromStorage: Exception: " + ex.ToString()); + //m_log.Error("[LandManager]: IncomingLandObjectsFromStorage: Exception: " + ex.ToString()); //throw ex; //} } @@ -526,8 +526,7 @@ namespace OpenSim.Region.Environment.LandManagement } catch (Exception e) { - MainLog.Instance.Debug("LAND", - "Skipped Land checks because avatar is out of bounds: " + e.Message); + m_log.Debug("[LAND]: Skipped Land checks because avatar is out of bounds: " + e.Message); } } } diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 76ba14bce8..d4031d9f8a 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs @@ -40,16 +40,16 @@ namespace OpenSim.Region.Environment { public class ModuleLoader { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public Dictionary LoadedAssemblys = new Dictionary(); private readonly List m_loadedModules = new List(); private readonly Dictionary m_loadedSharedModules = new Dictionary(); - private readonly LogBase m_log; private readonly IConfigSource m_config; - public ModuleLoader(LogBase log, IConfigSource config) + public ModuleLoader(IConfigSource config) { - m_log = log; m_config = config; } @@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment DynamicTextureModule dynamicModule = new DynamicTextureModule(); if (m_loadedSharedModules.ContainsKey(dynamicModule.Name)) { - m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", dynamicModule.Name, "DynamicTextureModule"); + m_log.Error(String.Format("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", dynamicModule.Name, "DynamicTextureModule")); } else { @@ -88,7 +88,7 @@ namespace OpenSim.Region.Environment ChatModule chat = new ChatModule(); if (m_loadedSharedModules.ContainsKey(chat.Name)) { - m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", chat.Name, "ChatModule"); + m_log.Error(String.Format("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", chat.Name, "ChatModule")); } else { @@ -98,7 +98,7 @@ namespace OpenSim.Region.Environment InstantMessageModule imMod = new InstantMessageModule(); if (m_loadedSharedModules.ContainsKey(imMod.Name)) { - m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", imMod.Name, "InstantMessageModule"); + m_log.Error(String.Format("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", imMod.Name, "InstantMessageModule")); } else { @@ -108,7 +108,7 @@ namespace OpenSim.Region.Environment LoadImageURLModule loadMod = new LoadImageURLModule(); if (m_loadedSharedModules.ContainsKey(loadMod.Name)) { - m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", loadMod.Name, "LoadImageURLModule"); + m_log.Error(String.Format("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", loadMod.Name, "LoadImageURLModule")); } else { @@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment AvatarFactoryModule avatarFactory = new AvatarFactoryModule(); if (m_loadedSharedModules.ContainsKey(avatarFactory.Name)) { - m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", avatarFactory.Name, "AvarFactoryModule"); + m_log.Error(String.Format("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", avatarFactory.Name, "AvarFactoryModule")); } else { @@ -128,7 +128,7 @@ namespace OpenSim.Region.Environment XMLRPCModule xmlRpcMod = new XMLRPCModule(); if (m_loadedSharedModules.ContainsKey(xmlRpcMod.Name)) { - m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", xmlRpcMod.Name, "XMLRPCModule"); + m_log.Error(String.Format("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", xmlRpcMod.Name, "XMLRPCModule")); } else { @@ -186,17 +186,17 @@ namespace OpenSim.Region.Environment if (modules.Length > 0) { - m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName); + m_log.Info(String.Format("[MODULES]: Found Module Library [{0}]", dllName)); foreach (IRegionModule module in modules) { if (!module.IsSharedModule) { - m_log.Verbose("MODULES", " [{0}]: Initializing.", module.Name); + m_log.Info(String.Format("[MODULES]: [{0}]: Initializing.", module.Name)); InitializeModule(module, scene); } else { - m_log.Verbose("MODULES", " [{0}]: Loading Shared Module.", module.Name); + m_log.Info(String.Format("[MODULES]: [{0}]: Loading Shared Module.", module.Name)); LoadSharedModule(module); } } @@ -246,7 +246,7 @@ namespace OpenSim.Region.Environment } catch (BadImageFormatException) { - //m_log.Verbose("MODULES", "The file [{0}] is not a module assembly.", e.FileName); + //m_log.Info(String.Format("[MODULES]: The file [{0}] is not a module assembly.", e.FileName)); } } @@ -270,7 +270,7 @@ namespace OpenSim.Region.Environment } catch (ReflectionTypeLoadException) { - m_log.Verbose("MODULES", "Could not load types for [{0}].", pluginAssembly.FullName); + m_log.Info(String.Format("[MODULES]: Could not load types for [{0}].", pluginAssembly.FullName)); } } diff --git a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs index 81478a1add..d51936b223 100644 --- a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs @@ -41,8 +41,7 @@ namespace OpenSim.Region.Environment.Modules { public class BetaGridLikeMoneyModule: IRegionModule { - - private LogBase m_log; + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private Dictionary m_scenel = new Dictionary(); @@ -66,8 +65,6 @@ namespace OpenSim.Region.Environment.Modules public void Initialise(Scene scene, IConfigSource config) { - m_log = MainLog.Instance; - m_gConfig = config; ReadConfigAndPopulate(); @@ -160,11 +157,8 @@ namespace OpenSim.Region.Environment.Modules } else { - MainLog.Instance.Warn("MONEY", "Potential Fraud Warning, got money transfer request for avatar that isn't in this simulator - Details; Sender:" + e.sender.ToString() + " Reciver: " + e.reciever.ToString() + " Amount: " + e.amount.ToString()); + m_log.Warn("[MONEY]: Potential Fraud Warning, got money transfer request for avatar that isn't in this simulator - Details; Sender:" + e.sender.ToString() + " Reciver: " + e.reciever.ToString() + " Amount: " + e.amount.ToString()); } - - - } private bool doMoneyTranfer(LLUUID Sender, LLUUID Receiver, int amount) diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 749a923868..82bd2ec6bc 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs @@ -43,8 +43,9 @@ namespace OpenSim.Region.Environment.Modules { public class ChatModule : IRegionModule, ISimChat { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private List m_scenes = new List(); - private LogBase m_log; private int m_whisperdistance = 10; private int m_saydistance = 30; @@ -59,11 +60,6 @@ namespace OpenSim.Region.Environment.Modules internal object m_syncLogout = new object(); private Thread m_irc_connector=null; - public ChatModule() - { - m_log = MainLog.Instance; - } - public void Initialise(Scene scene, IConfigSource config) { lock (m_syncInit) @@ -159,7 +155,7 @@ namespace OpenSim.Region.Environment.Modules } catch (Exception ex) { - m_log.Error("IRC", "NewClient exception trap:" + ex.ToString()); + m_log.Error("[IRC]: NewClient exception trap:" + ex.ToString()); } } @@ -180,13 +176,13 @@ namespace OpenSim.Region.Environment.Modules { m_last_leaving_user = clientName; m_irc.PrivMsg(m_irc.Nick, "Sim", "notices " + clientName + " left " + clientRegion); - m_log.Verbose("IRC", "IRC watcher notices " + clientName + " left " + clientRegion); + m_log.Info("[IRC]: IRC watcher notices " + clientName + " left " + clientRegion); } } } catch (Exception ex) { - m_log.Error("IRC", "ClientLoggedOut exception trap:" + ex.ToString()); + m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex.ToString()); } } @@ -319,6 +315,8 @@ namespace OpenSim.Region.Environment.Modules internal class IRCChatModule { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private string m_server = null; private uint m_port = 6668; private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; @@ -341,7 +339,6 @@ namespace OpenSim.Region.Environment.Modules private List m_scenes = null; private List m_last_scenes = null; - private LogBase m_log; public IRCChatModule(IConfigSource config) { @@ -388,9 +385,8 @@ namespace OpenSim.Region.Environment.Modules } catch (Exception) { - MainLog.Instance.Verbose("CHAT", "No IRC config information, skipping IRC bridge configuration"); + m_log.Info("[CHAT]: No IRC config information, skipping IRC bridge configuration"); } - m_log = MainLog.Instance; } public bool Connect(List scenes) @@ -404,9 +400,9 @@ namespace OpenSim.Region.Environment.Modules if (m_last_scenes == null) { m_last_scenes = scenes; } m_tcp = new TcpClient(m_server, (int)m_port); - m_log.Verbose("IRC", "Connecting..."); + m_log.Info("[IRC]: Connecting..."); m_stream = m_tcp.GetStream(); - m_log.Verbose("IRC", "Connected to " + m_server); + m_log.Info("[IRC]: Connected to " + m_server); m_reader = new StreamReader(m_stream); m_writer = new StreamWriter(m_stream); @@ -422,7 +418,7 @@ namespace OpenSim.Region.Environment.Modules m_writer.Flush(); m_writer.WriteLine("JOIN " + m_channel); m_writer.Flush(); - m_log.Verbose("IRC", "Connection fully established"); + m_log.Info("[IRC]: Connection fully established"); m_connected = true; } catch (Exception e) @@ -475,16 +471,16 @@ namespace OpenSim.Region.Environment.Modules m_writer.WriteLine(m_privmsgformat, m_channel, from, region, msg); } m_writer.Flush(); - m_log.Verbose("IRC", "PrivMsg " + from + " in " + region + " :" + msg); + m_log.Info("[IRC]: PrivMsg " + from + " in " + region + " :" + msg); } catch (IOException) { - m_log.Error("IRC", "Disconnected from IRC server.(PrivMsg)"); + m_log.Error("[IRC]: Disconnected from IRC server.(PrivMsg)"); Reconnect(); } catch (Exception ex) { - m_log.Error("IRC", "PrivMsg exception trap:" + ex.ToString()); + m_log.Error("[IRC]: PrivMsg exception trap:" + ex.ToString()); } } @@ -493,7 +489,7 @@ namespace OpenSim.Region.Environment.Modules //examines IRC commands and extracts any private messages // which will then be reboadcast in the Sim - m_log.Verbose("IRC", "ExtractMsg: " + input); + m_log.Info("[IRC]: ExtractMsg: " + input); Dictionary result = null; //string regex = @":(?\w*)!~(?\S*) PRIVMSG (?\S+) :(?.*)"; string regex = @":(?\w*)!(?\S*) PRIVMSG (?\S+) :(?.*)"; @@ -510,10 +506,10 @@ namespace OpenSim.Region.Environment.Modules } else { - m_log.Verbose("IRC", "Number of matches: " + matches.Count); + m_log.Info("[IRC]: Number of matches: " + matches.Count); if (matches.Count > 0) { - m_log.Verbose("IRC", "Number of groups: " + matches[0].Groups.Count); + m_log.Info("[IRC]: Number of groups: " + matches[0].Groups.Count); } } return result; @@ -536,12 +532,12 @@ namespace OpenSim.Region.Environment.Modules } catch (IOException) { - m_log.Error("IRC", "Disconnected from IRC server.(PingRun)"); + m_log.Error("[IRC]: Disconnected from IRC server.(PingRun)"); Reconnect(); } catch (Exception ex) { - m_log.Error("IRC", "PingRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace); + m_log.Error("[IRC]: PingRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace); } } } @@ -552,29 +548,29 @@ namespace OpenSim.Region.Environment.Modules LLVector3 pos = new LLVector3(128, 128, 20); while (true) { - try - { - while ((m_connected == true) && ((inputLine = m_reader.ReadLine()) != null)) + try { + while ((m_connected == true) && ((inputLine = m_reader.ReadLine()) != null)) + { // Console.WriteLine(inputLine); if (inputLine.Contains(m_channel)) { - Dictionary data = ExtractMsg(inputLine); + Dictionary data = ExtractMsg(inputLine); // Any chat ??? if (data != null) { foreach (Scene m_scene in m_scenes) { m_scene.ForEachScenePresence(delegate(ScenePresence avatar) + { + if (!avatar.IsChildAgent) { - if (!avatar.IsChildAgent) - { - avatar.ControllingClient.SendChatMessage( - Helpers.StringToField(data["msg"]), 255, - pos, data["nick"], - LLUUID.Zero); - } - }); + avatar.ControllingClient.SendChatMessage( + Helpers.StringToField(data["msg"]), 255, + pos, data["nick"], + LLUUID.Zero); + } + }); } @@ -584,24 +580,24 @@ namespace OpenSim.Region.Environment.Modules // Was an command from the IRC server ProcessIRCCommand(inputLine); } - } + } else { // Was an command from the IRC server ProcessIRCCommand(inputLine); } Thread.Sleep(150); - } - } - catch (IOException) - { - m_log.Error("IRC", "ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)"); - Reconnect(); - } - catch (Exception ex) - { - m_log.Error("IRC", "ListenerRun exception trap:" + ex.ToString()+"\n"+ex.StackTrace); } + } + catch (IOException) + { + m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)"); + Reconnect(); + } + catch (Exception ex) + { + m_log.Error("[IRC]: ListenerRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace); + } } } @@ -626,27 +622,27 @@ namespace OpenSim.Region.Environment.Modules } catch (Exception ex) // IRC gate should not crash Sim { - m_log.Error("IRC", "BroadcastSim Exception Trap:" + ex.ToString() + "\n" + ex.StackTrace); + m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex.ToString() + "\n" + ex.StackTrace); } - - } + public enum ErrorReplies { NotRegistered = 451, // ":You have not registered" NicknameInUse = 433 // " :Nickname is already in use" } + public enum Replies { MotdStart = 375, // ":- Message of the day - " Motd = 372, // ":- " EndOfMotd = 376 // ":End of /MOTD command" - } + public void ProcessIRCCommand(string command) { - //m_log.Verbose("IRC", "ProcessIRCCommand:"+command); + //m_log.Info("[IRC]: ProcessIRCCommand:" + command); string[] commArgs = new string[command.Split(' ').Length]; string c_server = m_server; @@ -656,6 +652,7 @@ namespace OpenSim.Region.Environment.Modules { commArgs[0] = commArgs[0].Remove(0, 1); } + if (commArgs[1] == "002") { // fetch the correct servername @@ -668,7 +665,7 @@ namespace OpenSim.Region.Environment.Modules if (commArgs[0] == "ERROR") { - m_log.Error("IRC", "IRC SERVER ERROR:" + command); + m_log.Error("[IRC]: IRC SERVER ERROR:" + command); } if (commArgs[0] == "PING") @@ -695,7 +692,7 @@ namespace OpenSim.Region.Environment.Modules case (int)ErrorReplies.NicknameInUse: // Gen a new name m_nick = m_basenick + Util.RandomClass.Next(1, 99); - m_log.Error("IRC", "IRC SERVER reports NicknameInUse, trying " + m_nick); + m_log.Error("[IRC]: IRC SERVER reports NicknameInUse, trying " + m_nick); // Retry m_writer.WriteLine("NICK " + m_nick); m_writer.Flush(); diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index fec28a8a84..3c324a42d5 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs @@ -40,8 +40,7 @@ namespace OpenSim.Region.Environment.Modules { public class FriendsModule : IRegionModule { - - private LogBase m_log; + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; @@ -49,7 +48,6 @@ namespace OpenSim.Region.Environment.Modules public void Initialise(Scene scene, IConfigSource config) { - m_log = MainLog.Instance; m_scene = scene; scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage; @@ -72,6 +70,7 @@ namespace OpenSim.Region.Environment.Modules } + private void OnInstantMessage(IClientAPI client,LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, @@ -89,13 +88,13 @@ namespace OpenSim.Region.Environment.Modules m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); - m_log.Verbose("FRIEND", "38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); + m_log.Info("[FRIEND]: 38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); GridInstantMessage msg = new GridInstantMessage(); msg.fromAgentID = fromAgentID.UUID; msg.fromAgentSession = fromAgentSession.UUID; msg.toAgentID = toAgentID.UUID; msg.imSessionID = friendTransactionID.UUID; // This is the item we're mucking with here - m_log.Verbose("FRIEND","Filling Session: " + msg.imSessionID.ToString()); + m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID.ToString()); msg.timestamp = timestamp; if (client != null) { @@ -115,20 +114,18 @@ namespace OpenSim.Region.Environment.Modules msg.binaryBucket = binaryBucket; m_scene.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); } - if (dialog == (byte)39) - { - m_log.Verbose("FRIEND", "38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); - - } - if (dialog == (byte)40) - { - m_log.Verbose("FRIEND", "38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); - } // 39 == Accept Friendship + if (dialog == (byte)39) + { + m_log.Info("[FRIEND]: 39 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); + } // 40 == Decline Friendship - + if (dialog == (byte)40) + { + m_log.Info("[FRIEND]: 40 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); + } } private void OnApprovedFriendRequest(IClientAPI client, LLUUID agentID, LLUUID transactionID, List callingCardFolders) @@ -160,6 +157,7 @@ namespace OpenSim.Region.Environment.Modules // TODO: Inform agent that the friend is online } } + private void OnDenyFriendRequest(IClientAPI client, LLUUID agentID, LLUUID transactionID, List callingCardFolders) { if (m_pendingFriendRequests.ContainsKey(transactionID)) @@ -184,20 +182,15 @@ namespace OpenSim.Region.Environment.Modules msg.binaryBucket = new byte[0]; m_scene.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); m_pendingFriendRequests.Remove(transactionID); - } - - } private void OnTerminateFriendship(IClientAPI client, LLUUID agent, LLUUID exfriendID) { m_scene.StoreRemoveFriendship(agent, exfriendID); // TODO: Inform the client that the ExFriend is offline - } - private void OnGridInstantMessage(GridInstantMessage msg) { // Trigger the above event handler @@ -206,16 +199,12 @@ namespace OpenSim.Region.Environment.Modules msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID, new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID), msg.binaryBucket); - } - public void PostInitialise() { } - - public void Close() { } @@ -230,4 +219,4 @@ namespace OpenSim.Region.Environment.Modules get { return false; } } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index f5eb052857..e0b31386e4 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs @@ -39,12 +39,6 @@ namespace OpenSim.Region.Environment.Modules public class InstantMessageModule : IRegionModule { private List m_scenes = new List(); - private LogBase m_log; - - public InstantMessageModule() - { - m_log = MainLog.Instance; - } public void Initialise(Scene scene, IConfigSource config) { @@ -68,7 +62,6 @@ namespace OpenSim.Region.Environment.Modules uint ParentEstateID, LLVector3 Position, LLUUID RegionID, byte[] binaryBucket) { - bool FriendDialog = ((dialog == (byte)38) || (dialog == (byte)39) || (dialog == (byte)40)); // IM dialogs need to be pre-processed and have their sessionID filled by the server diff --git a/OpenSim/Region/Environment/Modules/SunModule.cs b/OpenSim/Region/Environment/Modules/SunModule.cs index bd6cd63183..d2572c00fc 100644 --- a/OpenSim/Region/Environment/Modules/SunModule.cs +++ b/OpenSim/Region/Environment/Modules/SunModule.cs @@ -39,6 +39,8 @@ namespace OpenSim.Region.Environment.Modules { public class SunModule : IRegionModule { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private const double m_real_day = 24.0; private const int m_default_frame = 100; private int m_frame_mod; @@ -48,7 +50,6 @@ namespace OpenSim.Region.Environment.Modules private long m_start; private Scene m_scene; - private LogBase m_log; public void Initialise(Scene scene, IConfigSource config) { @@ -69,7 +70,6 @@ namespace OpenSim.Region.Environment.Modules m_dilation = (int) (m_real_day/m_day_length); m_scene = scene; - m_log = MainLog.Instance; scene.EventManager.OnFrame += SunUpdate; scene.EventManager.OnNewClient += SunToClient; } @@ -104,7 +104,7 @@ namespace OpenSim.Region.Environment.Modules m_frame++; return; } - // m_log.Verbose("SUN","I've got an update {0} => {1}", m_scene.RegionsInfo.RegionName, HourOfTheDay()); + // m_log.Info("[SUN]: I've got an update {0} => {1}", m_scene.RegionsInfo.RegionName, HourOfTheDay()); List avatars = m_scene.GetAvatars(); foreach (ScenePresence avatar in avatars) { @@ -191,4 +191,4 @@ namespace OpenSim.Region.Environment.Modules // // OutPacket(viewertime); // } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/TextureSender.cs b/OpenSim/Region/Environment/Modules/TextureSender.cs index a53307824c..053a558677 100644 --- a/OpenSim/Region/Environment/Modules/TextureSender.cs +++ b/OpenSim/Region/Environment/Modules/TextureSender.cs @@ -36,6 +36,8 @@ namespace OpenSim.Region.Environment.Modules { public class TextureSender { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public int counter = 0; private AssetBase m_asset; public long DataPointer = 0; @@ -135,9 +137,8 @@ namespace OpenSim.Region.Environment.Modules } catch (ArgumentOutOfRangeException) { - MainLog.Instance.Error("TEXTURE", - "Unable to separate texture into multiple packets: Array bounds failure on asset:" + - m_asset.FullID.ToString() ); + m_log.Error("[TEXTURE]: Unable to separate texture into multiple packets: Array bounds failure on asset:" + + m_asset.FullID.ToString() ); return; } RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs index 76c6a538c7..762e76de80 100644 --- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs +++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs @@ -75,6 +75,8 @@ namespace OpenSim.Region.Environment.Modules { public class XMLRPCModule : IRegionModule, IXMLRPC { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; private Queue rpcQueue = new Queue(); private object XMLRPCListLock = new object(); @@ -83,7 +85,6 @@ namespace OpenSim.Region.Environment.Modules private int RemoteReplyScriptTimeout = 900; private int m_remoteDataPort = 0; private List m_scenes = new List(); - private LogBase m_log; // private Dictionary m_openChannels; @@ -91,11 +92,6 @@ namespace OpenSim.Region.Environment.Modules // private Dictionary m_pendingResponse; - public XMLRPCModule() - { - m_log = MainLog.Instance; - } - public void Initialise(Scene scene, IConfigSource config) { try @@ -123,8 +119,8 @@ namespace OpenSim.Region.Environment.Modules // Start http server // Attach xmlrpc handlers - m_log.Verbose("REMOTE_DATA", - "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); + m_log.Info("[REMOTE_DATA]: " + + "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort); httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); httpServer.Start(); @@ -413,4 +409,4 @@ namespace OpenSim.Region.Environment.Modules return m_localID; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs b/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs index 18a87cb49a..daaa3194ee 100644 --- a/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs +++ b/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs @@ -35,6 +35,8 @@ namespace OpenSim.Region.Environment.Scenes { public class AvatarAnimations { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public Dictionary AnimsLLUUID = new Dictionary(); public Dictionary AnimsNames = new Dictionary(); @@ -44,7 +46,7 @@ namespace OpenSim.Region.Environment.Scenes public void LoadAnims() { - //MainLog.Instance.Verbose("CLIENT", "Loading avatar animations"); + //m_log.Info("[CLIENT]: Loading avatar animations"); using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) { XmlDocument doc = new XmlDocument(); @@ -58,7 +60,7 @@ namespace OpenSim.Region.Environment.Scenes } } - // MainLog.Instance.Verbose("CLIENT", "Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); + // m_log.Info("[CLIENT]: Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); try { @@ -70,7 +72,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (InvalidOperationException) { - MainLog.Instance.Warn("AVATAR", "Unable to load animation names for an Avatar"); + m_log.Warn("[AVATAR]: Unable to load animation names for an Avatar"); } } } diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 6c0ed28636..49aeaf9a00 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -42,6 +42,8 @@ namespace OpenSim.Region.Environment.Scenes public class InnerScene { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + #region Events public event PhysicsCrash UnRecoverableError; @@ -227,13 +229,13 @@ namespace OpenSim.Region.Environment.Scenes if (child) { m_numChildAgents++; - MainLog.Instance.Verbose("SCENE", m_regInfo.RegionName + ": Creating new child agent."); + m_log.Info("[SCENE]: " + m_regInfo.RegionName + ": Creating new child agent."); } else { m_numRootAgents++; - MainLog.Instance.Verbose("SCENE", m_regInfo.RegionName + ": Creating new root agent."); - MainLog.Instance.Verbose("SCENE", m_regInfo.RegionName + ": Adding Physical agent."); + m_log.Info("[SCENE]: " + m_regInfo.RegionName + ": Creating new root agent."); + m_log.Info("[SCENE]: " + m_regInfo.RegionName + ": Adding Physical agent."); newAvatar.AddToPhysicalScene(); } @@ -542,7 +544,7 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition; float distResult = (float)Util.GetDistanceTo(presence.AbsolutePosition,oLoc); - //MainLog.Instance.Verbose("DISTANCE", distResult.ToString()); + //m_log.Info("[DISTANCE]: " + distResult.ToString()); if (distResult > 60) { @@ -897,9 +899,9 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Verbose("SCENE", + m_log.Info(String.Format("[SCENE]: " + "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", - primIds); + primIds)); } } @@ -947,7 +949,7 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Warn("SCENE", "Attempted to duplicate nonexistant prim id {0}", GroupID); + m_log.Warn(String.Format("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID)); } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 81783f8489..28760fdfd2 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -26,6 +26,7 @@ * */ +using System; using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; @@ -37,12 +38,14 @@ namespace OpenSim.Region.Environment.Scenes { public partial class Scene { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// Start all the scripts in the scene which should be started. /// public void StartScripts() { - MainLog.Instance.Verbose("PRIMINVENTORY", "Starting scripts in scene"); + m_log.Info("[PRIMINVENTORY]: Starting scripts in scene"); foreach (SceneObjectGroup group in Entities.Values) { @@ -80,8 +83,8 @@ namespace OpenSim.Region.Environment.Scenes if (!TryGetAvatar(avatarId, out avatar)) { - MainLog.Instance.Error( - "AGENTINVENTORY", "Could not find avatar {0} to add inventory item", avatarId); + m_log.Error(String.Format( + "[AGENTINVENTORY]: Could not find avatar {0} to add inventory item", avatarId)); return; } @@ -143,10 +146,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "AGENTINVENTORY", - "Avatar {0} cannot be found to update its inventory item asset", - avatarId); + m_log.Error(String.Format( + "[AGENTINVENTORY]: " + + "Avatar {0} cannot be found to update its inventory item asset", + avatarId)); } return LLUUID.Zero; @@ -168,10 +171,10 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = part.ParentGroup; if (null == group) { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist", - itemId, primId); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist", + itemId, primId)); return; } @@ -217,10 +220,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Avatar {0} cannot be found to update its prim item asset", - avatarId); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Avatar {0} cannot be found to update its prim item asset", + avatarId)); } } @@ -289,16 +292,14 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "AGENTINVENTORY", - "Item ID " + itemID + " not found for an inventory item update."); + m_log.Error( + "[AGENTINVENTORY]: Item ID " + itemID + " not found for an inventory item update."); } } else { - MainLog.Instance.Error( - "AGENTINVENTORY", - "Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); + m_log.Error( + "[AGENTINVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); } } @@ -311,7 +312,7 @@ namespace OpenSim.Region.Environment.Scenes CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); if (userInfo == null) { - MainLog.Instance.Error("AGENTINVENTORY", "Failed to find user " + oldAgentID.ToString()); + m_log.Error("[AGENTINVENTORY]: Failed to find user " + oldAgentID.ToString()); return; } @@ -320,13 +321,13 @@ namespace OpenSim.Region.Environment.Scenes item = userInfo.RootFolder.HasItem(oldItemID); if (item == null) { - MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString()); + m_log.Error("[AGENTINVENTORY]: Failed to find item " + oldItemID.ToString()); return; } } else { - MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString()); + m_log.Error("[AGENTINVENTORY]: Failed to find item " + oldItemID.ToString()); return; } } @@ -335,7 +336,7 @@ namespace OpenSim.Region.Environment.Scenes AssetBase asset = AssetCache.CopyAsset(item.assetID); if (asset == null) { - MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find asset " + item.assetID.ToString()); + m_log.Warn("[AGENTINVENTORY]: Failed to find asset " + item.assetID.ToString()); return; } @@ -360,14 +361,14 @@ namespace OpenSim.Region.Environment.Scenes public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, string newName) { - MainLog.Instance.Verbose( - "AGENTINVENTORY", + m_log.Info( + "[AGENTINVENTORY]: " + "Moving item for " + remoteClient.AgentId.ToString()); CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); if (userInfo == null) { - MainLog.Instance.Error("AGENTINVENTORY", "Failed to find user " + remoteClient.AgentId.ToString()); + m_log.Error("[AGENTINVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); return; } @@ -388,13 +389,13 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + itemID.ToString()); + m_log.Error("[AGENTINVENTORY]: Failed to find item " + itemID.ToString()); return; } } else { - MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + itemID.ToString() + ", no root folder"); + m_log.Error("[AGENTINVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder"); return; } } @@ -497,8 +498,8 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", "Inventory requested of prim {0} which doesn't exist", primLocalID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: Inventory requested of prim {0} which doesn't exist", primLocalID)); } } @@ -523,11 +524,11 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Removal of item {0} requested of prim {1} but this prim does not exist", - itemID, - localID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Removal of item {0} requested of prim {1} but this prim does not exist", + itemID, + localID)); } } @@ -547,18 +548,18 @@ namespace OpenSim.Region.Environment.Scenes { // TODO Retrieve itemID from client's inventory to pass on //group.AddInventoryItem(remoteClient, primLocalID, null); - MainLog.Instance.Verbose( - "PRIMINVENTORY", - "Non script prim inventory not yet implemented!" - + "\nUpdateTaskInventory called with item {0}, folder {1}, primLocalID {2}, user {3}", - itemID, folderID, primLocalID, remoteClient.Name); + m_log.Info(String.Format( + "[PRIMINVENTORY]: " + + "Non script prim inventory not yet implemented!" + + "\nUpdateTaskInventory called with item {0}, folder {1}, primLocalID {2}, user {3}", + itemID, folderID, primLocalID, remoteClient.Name)); } else { - MainLog.Instance.Warn( - "PRIMINVENTORY", - "Update with item {0} requested of prim {1} for {2} but this prim does not exist", - itemID, primLocalID, remoteClient.Name); + m_log.Warn(String.Format( + "[PRIMINVENTORY]: " + + "Update with item {0} requested of prim {1} for {2} but this prim does not exist", + itemID, primLocalID, remoteClient.Name)); } } @@ -596,25 +597,25 @@ namespace OpenSim.Region.Environment.Scenes group.StartScript(localID, copyID); group.GetProperites(remoteClient); - // MainLog.Instance.Verbose( - // "PRIMINVENTORY", - // "Rezzed script {0} into prim local ID {1} for user {2}", - // item.inventoryName, localID, remoteClient.Name); + // m_log.Info( + // String.Format("[PRIMINVENTORY]: " + + // "Rezzed script {0} into prim local ID {1} for user {2}", + // item.inventoryName, localID, remoteClient.Name)); } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Could not rez script {0} into prim local ID {1} for user {2}" - + " because the prim could not be found in the region!", - item.inventoryName, localID, remoteClient.Name); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Could not rez script {0} into prim local ID {1} for user {2}" + + " because the prim could not be found in the region!", + item.inventoryName, localID, remoteClient.Name)); } } else { - MainLog.Instance.Error( - "PRIMINVENTORY", "Could not find script inventory item {0} to rez for {1}!", - itemID, remoteClient.Name); + m_log.Error(String.Format( + "[PRIMINVENTORY]: Could not find script inventory item {0} to rez for {1}!", + itemID, remoteClient.Name)); } } } @@ -646,7 +647,7 @@ namespace OpenSim.Region.Environment.Scenes foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) { EntityBase selectedEnt = null; - //MainLog.Instance.Verbose("CLIENT", "LocalID:" + Data.ObjectLocalID.ToString()); + //m_log.Info("[CLIENT]: LocalID:" + Data.ObjectLocalID.ToString()); List EntitieList = GetEntities(); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 1d688e3851..a724ac0b87 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -270,12 +270,12 @@ namespace OpenSim.Region.Environment.Scenes RegisterDefaultSceneEvents(); - MainLog.Instance.Verbose("SCENE", "Creating new entitities instance"); + m_log.Info("[SCENE]: Creating new entitities instance"); Entities = new Dictionary(); m_scenePresences = new Dictionary(); //m_sceneObjects = new Dictionary(); - MainLog.Instance.Verbose("SCENE", "Creating LandMap"); + m_log.Info("[SCENE]: Creating LandMap"); Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY); ScenePresence.LoadAnims(); @@ -365,16 +365,14 @@ namespace OpenSim.Region.Environment.Scenes { // This means that we're not booted up completely yet. // This shouldn't happen too often anymore. - MainLog.Instance.Error("SCENE", - "Couldn't inform client of regionup because we got a null reference exception"); + m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception"); } } else { - MainLog.Instance.Verbose("INTERGRID", - "Got notice about far away Region: " + otherRegion.RegionName.ToString() + - " at (" + otherRegion.RegionLocX.ToString() + ", " + - otherRegion.RegionLocY.ToString() + ")"); + m_log.Info("[INTERGRID]: Got notice about far away Region: " + otherRegion.RegionName.ToString() + + " at (" + otherRegion.RegionLocX.ToString() + ", " + + otherRegion.RegionLocY.ToString() + ")"); } } return true; @@ -402,7 +400,7 @@ namespace OpenSim.Region.Environment.Scenes m_RestartTimerCounter = 0; m_restartTimer.AutoReset = true; m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); - MainLog.Instance.Error("REGION", "Restarting Region in " + (seconds/60) + " minutes"); + m_log.Error("[REGION]: Restarting Region in " + (seconds/60) + " minutes"); m_restartTimer.Start(); SendRegionMessageFromEstateTools(LLUUID.Random(), LLUUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes"); //SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes"); @@ -436,9 +434,9 @@ namespace OpenSim.Region.Environment.Scenes // This causes the region to restart immediatley. public void RestartNow() { - MainLog.Instance.Error("REGION", "Closing"); + m_log.Error("[REGION]: Closing"); Close(); - MainLog.Instance.Error("REGION", "Firing Region Restart Message"); + m_log.Error("[REGION]: Firing Region Restart Message"); base.Restart(0); } @@ -485,7 +483,7 @@ namespace OpenSim.Region.Environment.Scenes if (m_scripts_enabled != !ScriptEngine) { // Tedd! Here's the method to disable the scripting engine! - MainLog.Instance.Verbose("TOTEDD", "Here is the method to trigger disabling of the scripting engine"); + m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); } if (m_physics_enabled != !PhysicsEngine) { @@ -498,7 +496,7 @@ namespace OpenSim.Region.Environment.Scenes // This is the method that shuts down the scene. public override void Close() { - MainLog.Instance.Warn("SCENE", "Closing down the single simulator: " + RegionInfo.RegionName); + m_log.Warn("[SCENE]: Closing down the single simulator: " + RegionInfo.RegionName); // Kick all ROOT agents with the message, 'The simulator is going down' ForEachScenePresence(delegate(ScenePresence avatar) { @@ -543,7 +541,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void StartTimer() { - MainLog.Instance.Debug("SCENE", "Starting timer"); + m_log.Debug("[SCENE]: Starting timer"); m_heartbeatTimer.Enabled = true; m_heartbeatTimer.Interval = (int) (m_timespan*1000); m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); @@ -649,7 +647,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - MainLog.Instance.Error("Scene", "Failed with exception " + e.ToString()); + m_log.Error("[Scene]: Failed with exception " + e.ToString()); } finally { @@ -848,7 +846,7 @@ namespace OpenSim.Region.Environment.Scenes { if (string.IsNullOrEmpty(m_regInfo.EstateSettings.terrainFile)) { - MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain."); + m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); Terrain.SetDefaultTerrain(); m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); @@ -862,8 +860,7 @@ namespace OpenSim.Region.Environment.Scenes } catch { - MainLog.Instance.Verbose("TERRAIN", - "No terrain found in database or default. Generating a new terrain."); + m_log.Info("[TERRAIN]: No terrain found in database or default. Generating a new terrain."); Terrain.SetDefaultTerrain(); } m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); @@ -879,7 +876,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - MainLog.Instance.Warn("terrain", "Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString()); + m_log.Warn("[terrain]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString()); } } @@ -894,12 +891,12 @@ namespace OpenSim.Region.Environment.Scenes { if (dGridSettings["allow_forceful_banlines"] != "TRUE") { - MainLog.Instance.Verbose("GRID", "Grid is disabling forceful parcel banlists"); + m_log.Info("[GRID]: Grid is disabling forceful parcel banlists"); m_LandManager.allowedForcefulBans = false; } else { - MainLog.Instance.Verbose("GRID", "Grid is allowing forceful parcel banlists"); + m_log.Info("[GRID]: Grid is allowing forceful parcel banlists"); m_LandManager.allowedForcefulBans = true; } } @@ -929,7 +926,7 @@ namespace OpenSim.Region.Environment.Scenes public void loadAllLandObjectsFromStorage() { - MainLog.Instance.Verbose("SCENE", "Loading land objects from storage"); + m_log.Info("[SCENE]: Loading land objects from storage"); List landData = m_storageManager.DataStore.LoadLandObjects(RegionInfo.RegionID); if (landData.Count == 0) @@ -951,7 +948,7 @@ namespace OpenSim.Region.Environment.Scenes /// public virtual void LoadPrimsFromStorage(bool m_permissions) { - MainLog.Instance.Verbose("SCENE", "Loading objects from datastore"); + m_log.Info("[SCENE]: Loading objects from datastore"); List PrimsFromDB = m_storageManager.DataStore.LoadObjects(m_regInfo.RegionID); foreach (SceneObjectGroup group in PrimsFromDB) @@ -964,7 +961,7 @@ namespace OpenSim.Region.Environment.Scenes //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); } - MainLog.Instance.Verbose("SCENE", "Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); + m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); } @@ -999,7 +996,7 @@ namespace OpenSim.Region.Environment.Scenes { pos = target.AbsolutePosition; - //MainLog.Instance.Verbose("RAYTRACE", pos.ToString()); + //m_log.Info("[RAYTRACE]: " + pos.ToString()); //EntityIntersection rayTracing = null; //ScenePresence presence = ((ScenePresence)GetScenePresence(ownerID)); //if (presence != null) @@ -1038,14 +1035,10 @@ namespace OpenSim.Region.Environment.Scenes //Vector3 RezPoint = Newpos; - //MainLog.Instance.Verbose("REZINFO", "Possible Rez Point:" + RezPoint.ToString()); + //m_log.Info("[REZINFO]: Possible Rez Point:" + RezPoint.ToString()); //pos = new LLVector3(RezPoint.x, RezPoint.y, RezPoint.z); //} - - - - return pos; } else @@ -1061,18 +1054,14 @@ namespace OpenSim.Region.Environment.Scenes pos = RayEnd; return pos; } - } public virtual void AddNewPrim(LLUUID ownerID, LLVector3 RayEnd, LLQuaternion rot, PrimitiveBaseShape shape, - byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID, - byte RayEndIsIntersection) + byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID, + byte RayEndIsIntersection) { LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); - - - if (PermissionsMngr.CanRezObject(ownerID, pos)) { // rez ON the ground, not IN the ground @@ -1364,7 +1353,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - MainLog.Instance.Error("Scene.cs:RemoveClient exception: " + e.ToString()); + m_log.Error("Scene.cs:RemoveClient exception: " + e.ToString()); } // Remove client agent from profile, so new logins will work @@ -1474,7 +1463,7 @@ namespace OpenSim.Region.Environment.Scenes if (m_capsHandlers.ContainsKey(agent.AgentID)) { - //MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + + //m_log.Warn("[client]: Adding duplicate CAPS entry for user " + // agent.AgentID.ToString()); try { @@ -1514,8 +1503,8 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - MainLog.Instance.Verbose("SCENE", "Unable to do Agent Crossing."); - MainLog.Instance.Debug("SCENE", e.ToString()); + m_log.Info("[SCENE]: Unable to do Agent Crossing."); + m_log.Debug("[SCENE]: " + e.ToString()); } //m_innerScene.SwapRootChildAgent(false); } @@ -2158,14 +2147,14 @@ namespace OpenSim.Region.Environment.Scenes switch (showWhat) { case "users": - MainLog.Instance.Error("Current Region: " + RegionInfo.RegionName); - MainLog.Instance.Error( + m_log.Error("Current Region: " + RegionInfo.RegionName); + m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); foreach (ScenePresence scenePrescence in GetAvatars()) { - MainLog.Instance.Error( + m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", scenePrescence.Firstname, scenePrescence.Lastname, @@ -2177,12 +2166,12 @@ namespace OpenSim.Region.Environment.Scenes } break; case "modules": - MainLog.Instance.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:"); + m_log.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:"); foreach (IRegionModule module in Modules.Values) { if (!module.IsSharedModule) { - MainLog.Instance.Error("Region Module: " + module.Name); + m_log.Error("Region Module: " + module.Name); } } break; @@ -2250,11 +2239,10 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - /// - public void AddScriptEngine(ScriptEngineInterface scriptEngine, LogBase logger) + public void AddScriptEngine(ScriptEngineInterface scriptEngine) { ScriptEngines.Add(scriptEngine); - scriptEngine.InitializeEngine(this, logger); + scriptEngine.InitializeEngine(this); } public void TriggerObjectChanged(uint localID, uint change) @@ -2372,7 +2360,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - MainLog.Instance.Verbose("BUG", e.ToString()); + m_log.Info("[BUG]: " + e.ToString()); } } } diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index d4a4bb071e..2e9532277a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -36,6 +36,8 @@ namespace OpenSim.Region.Environment.Scenes { public abstract class SceneBase : IScene { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + #region Events public event restart OnRestart; @@ -155,7 +157,7 @@ namespace OpenSim.Region.Environment.Scenes /// public virtual void Restart(int seconds) { - MainLog.Instance.Error("REGION", "passing Restart Message up the namespace"); + m_log.Error("[REGION]: passing Restart Message up the namespace"); OnRestart(RegionInfo); } @@ -180,7 +182,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - MainLog.Instance.Error("SCENE", "SceneBase.cs: Close() - Failed with exception " + e.ToString()); + m_log.Error("[SCENE]: SceneBase.cs: Close() - Failed with exception " + e.ToString()); } } diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 2bb36a366b..a89b52c2e8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -40,6 +40,8 @@ namespace OpenSim.Region.Environment.Scenes public class SceneCommunicationService //one instance per region { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected CommunicationsManager m_commsProvider; protected RegionInfo m_regionInfo; @@ -77,7 +79,7 @@ namespace OpenSim.Region.Environment.Scenes if (regionCommsHost != null) { - //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString()); + //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString()); regionCommsHost.debugRegionName = _debugRegionName; @@ -91,7 +93,7 @@ namespace OpenSim.Region.Environment.Scenes } else { - //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: registered with gridservice and got null"); + //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null"); } } @@ -122,7 +124,7 @@ namespace OpenSim.Region.Environment.Scenes { if (OnExpectUser != null) { - //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: OnExpectUser Fired for User:" + agent.firstname + " " + agent.lastname); + //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: OnExpectUser Fired for User:" + agent.firstname + " " + agent.lastname); OnExpectUser(regionHandle, agent); } } @@ -131,7 +133,7 @@ namespace OpenSim.Region.Environment.Scenes { if (OnRegionUp != null) { - //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName); + //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName); OnRegionUp(region); } return true; @@ -164,7 +166,7 @@ namespace OpenSim.Region.Environment.Scenes protected bool CloseConnection(ulong regionHandle, LLUUID agentID) { - MainLog.Instance.Verbose("INTERREGION", "Incoming Agent Close Request for agent: " + agentID.ToString()); + m_log.Info("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID.ToString()); if (OnCloseAgentConnection != null) { @@ -199,14 +201,14 @@ namespace OpenSim.Region.Environment.Scenes private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint) { - MainLog.Instance.Notice("INTERGRID", "Starting to inform client about neighbours"); + m_log.Info("[INTERGRID]: Starting to inform client about neighbours"); bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, a); if (regionAccepted) { avatar.ControllingClient.InformClientOfNeighbour(regionHandle, endPoint); avatar.AddNeighbourRegion(regionHandle); - MainLog.Instance.Notice("INTERGRID", "Completed inform client about neighbours"); + m_log.Info("[INTERGRID]: Completed inform client about neighbours"); } } @@ -291,17 +293,17 @@ namespace OpenSim.Region.Environment.Scenes private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle) { - MainLog.Instance.Notice("INTERGRID", "Starting to inform neighbors that I'm here"); + m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here"); bool regionAccepted = m_commsProvider.InterRegion.RegionUp((new SearializableRegionInfo(region)), regionhandle); if (regionAccepted) { - MainLog.Instance.Notice("INTERGRID", "Completed informing neighbors that I'm here"); + m_log.Info("[INTERGRID]: Completed informing neighbors that I'm here"); } else { - MainLog.Instance.Notice("INTERGRID", "Failed to inform neighbors that I'm here"); + m_log.Info("[INTERGRID]: Failed to inform neighbors that I'm here"); } } @@ -311,7 +313,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void InformNeighborsThatRegionisUp(RegionInfo region) { - //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); + //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); List neighbours = new List(); @@ -343,7 +345,7 @@ namespace OpenSim.Region.Environment.Scenes /// private void SendChildAgentDataUpdateAsync(ChildAgentDataUpdate cAgentData, ScenePresence presence) { - //MainLog.Instance.Notice("INTERGRID", "Informing neighbors about my agent."); + //m_log.Info("[INTERGRID]: Informing neighbors about my agent."); try { foreach (ulong regionHandle in presence.KnownChildRegions) @@ -352,11 +354,11 @@ namespace OpenSim.Region.Environment.Scenes if (regionAccepted) { - //MainLog.Instance.Notice("INTERGRID", "Completed sending a neighbor an update about my agent"); + //m_log.Info("[INTERGRID]: Completed sending a neighbor an update about my agent"); } else { - //MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent"); + //m_log.Info("[INTERGRID]: Failed sending a neighbor an update about my agent"); } } } @@ -397,12 +399,12 @@ namespace OpenSim.Region.Environment.Scenes if (regionAccepted) { - MainLog.Instance.Notice("INTERGRID", "Completed sending agent Close agent Request to neighbor"); + m_log.Info("[INTERGRID]: Completed sending agent Close agent Request to neighbor"); presence.RemoveNeighbourRegion(regionHandle); } else { - MainLog.Instance.Notice("INTERGRID", "Failed sending agent Close agent Request to neighbor"); + m_log.Info("[INTERGRID]: Failed sending agent Close agent Request to neighbor"); } @@ -431,7 +433,7 @@ namespace OpenSim.Region.Environment.Scenes /// public virtual RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) { - //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionHandle.ToString()); + //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionHandle.ToString()); return m_commsProvider.GridService.RequestNeighbourInfo(regionHandle); } diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 1eac61bbc9..7156428eda 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -38,6 +38,8 @@ namespace OpenSim.Region.Environment.Scenes public class SceneManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public event RestartSim OnRestartSim; private readonly List m_localScenes; @@ -98,8 +100,7 @@ namespace OpenSim.Region.Environment.Scenes public void HandleRestart(RegionInfo rdata) { - MainLog.Instance.Error("SCENEMANAGER", - "Got Restart message for region:" + rdata.RegionName + " Sending up to main"); + m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); int RegionSceneElement = -1; for (int i = 0; i < m_localScenes.Count; i++) { @@ -146,7 +147,7 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error("REGION", "Unable to notify Other regions of this Region coming up"); + m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up"); } } @@ -285,29 +286,29 @@ namespace OpenSim.Region.Environment.Scenes return false; } - public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) + public void SetDebugPacketOnCurrentScene(int newDebug) { ForEachCurrentScene(delegate(Scene scene) + { + List EntitieList = scene.GetEntities(); + + foreach (EntityBase entity in EntitieList) { - List EntitieList = scene.GetEntities(); - - foreach (EntityBase entity in EntitieList) + if (entity is ScenePresence) { - if (entity is ScenePresence) + ScenePresence scenePrescence = entity as ScenePresence; + if (!scenePrescence.IsChildAgent) { - ScenePresence scenePrescence = entity as ScenePresence; - if (!scenePrescence.IsChildAgent) - { - log.Error(String.Format("Packet debug for {0} {1} set to {2}", - scenePrescence.Firstname, - scenePrescence.Lastname, - newDebug)); + m_log.Error(String.Format("Packet debug for {0} {1} set to {2}", + scenePrescence.Firstname, + scenePrescence.Lastname, + newDebug)); - scenePrescence.ControllingClient.SetDebug(newDebug); - } + scenePrescence.ControllingClient.SetDebug(newDebug); } } - }); + } + }); } public List GetCurrentSceneAvatars() diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index 1bddf25d61..0956f74f77 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs @@ -38,6 +38,8 @@ namespace OpenSim.Region.Environment.Scenes { public partial class SceneObjectGroup : EntityBase { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// /// Start a given script. /// @@ -53,10 +55,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Couldn't find part {0} in object group {1}, {2} to start script with ID {3}", - localID, Name, UUID, itemID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Couldn't find part {0} in object group {1}, {2} to start script with ID {3}", + localID, Name, UUID, itemID)); } } @@ -74,10 +76,10 @@ namespace OpenSim.Region.Environment.Scenes // } // else // { -// MainLog.Instance.Error( -// "PRIMINVENTORY", -// "Couldn't find part {0} in object group {1}, {2} to start script with ID {3}", -// localID, Name, UUID, itemID); +// m_log.Error(String.Format( +// "[PRIMINVENTORY]: " + +// "Couldn't find part {0} in object group {1}, {2} to start script with ID {3}", +// localID, Name, UUID, itemID)); // } // } @@ -106,10 +108,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Couldn't find part {0} in object group {1}, {2} to stop script with ID {3}", - partID, Name, UUID, itemID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Couldn't find part {0} in object group {1}, {2} to stop script with ID {3}", + partID, Name, UUID, itemID)); } } @@ -127,10 +129,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory", - localID, Name, UUID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory", + localID, Name, UUID)); } return false; } @@ -144,10 +146,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Couldn't find part {0} in object group {1}, {2} to request inventory data", - localID, Name, UUID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Couldn't find part {0} in object group {1}, {2} to request inventory data", + localID, Name, UUID)); } } @@ -183,10 +185,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}", - localID, Name, UUID, newItemId); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}", + localID, Name, UUID, newItemId)); } return false; @@ -207,10 +209,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Couldn't find prim local ID {0} in prim {1}, {2} to get inventory item ID {3}", - primID, part.Name, part.UUID, itemID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Couldn't find prim local ID {0} in prim {1}, {2} to get inventory item ID {3}", + primID, part.Name, part.UUID, itemID)); } return null; @@ -233,10 +235,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Couldn't find prim ID {0} to update item {1}, {2}", - item.ParentPartID, item.Name, item.ItemID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Couldn't find prim ID {0} to update item {1}, {2}", + item.ParentPartID, item.Name, item.ItemID)); } return false; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 10395b6051..4fe7b551e3 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1003,9 +1003,9 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Verbose("SCENE", + m_log.Info(String.Format("[SCENE]: " + "DelinkFromGroup(): Child prim local id {0} not found in object with root prim id {1}", - partID, LocalId); + partID, LocalId)); } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index d4e2102b1d..d9ee94c0dd 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -41,6 +41,8 @@ namespace OpenSim.Region.Environment.Scenes { public partial class SceneObjectPart : IScriptHost { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private string m_inventoryFileName = String.Empty; /// @@ -131,10 +133,10 @@ namespace OpenSim.Region.Environment.Scenes /// public void StartScript(TaskInventoryItem item) { -// MainLog.Instance.Verbose( -// "PRIMINVENTORY", -// "Starting script {0}, {1} in prim {2}, {3}", -// item.Name, item.ItemID, Name, UUID); +// m_log.Info(String.Format( +// "[PRIMINVENTORY]: " + +// "Starting script {0}, {1} in prim {2}, {3}", +// item.Name, item.ItemID, Name, UUID)); AssetBase rezAsset = m_parentGroup.Scene.AssetCache.GetAsset(item.AssetID, false); @@ -145,10 +147,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Couldn't start script {0}, {1} since asset ID {2} could not be found", - item.Name, item.ItemID, item.AssetID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Couldn't start script {0}, {1} since asset ID {2} could not be found", + item.Name, item.ItemID, item.AssetID)); } } @@ -168,10 +170,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}", - itemId, Name, UUID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}", + itemId, Name, UUID)); } } } @@ -188,10 +190,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}", - itemId, Name, UUID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}", + itemId, Name, UUID)); } } @@ -251,10 +253,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", - itemID, Name, UUID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", + itemID, Name, UUID)); } } @@ -283,10 +285,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", - item.ItemID, Name, UUID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", + item.ItemID, Name, UUID)); } } @@ -316,10 +318,10 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Error( - "PRIMINVENTORY", - "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory", - itemID, Name, UUID); + m_log.Error(String.Format( + "[PRIMINVENTORY]: " + + "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory", + itemID, Name, UUID)); } } @@ -384,8 +386,8 @@ namespace OpenSim.Region.Environment.Scenes fileData = Helpers.StringToField(invString.BuildString); -// MainLog.Instance.Verbose( -// "PRIMINVENTORY", "RequestInventoryFile fileData: {0}", Helpers.FieldToUTF8String(fileData)); +// m_log.Info(String.Format( +// "[PRIMINVENTORY]: RequestInventoryFile fileData: {0}", Helpers.FieldToUTF8String(fileData))); if (fileData.Length > 2) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 0ba64f21f3..4456fce9b3 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -306,7 +306,7 @@ namespace OpenSim.Region.Environment.Scenes { // Ignore, and skip over. } - //MainLog.Instance.Verbose("PART", "OFFSET:" + m_offsetPosition, ToString()); + //m_log.Info("[PART]: OFFSET:" + m_offsetPosition.ToString()); } } @@ -347,14 +347,14 @@ namespace OpenSim.Region.Environment.Scenes if (ParentID == 0) { PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z); - //MainLog.Instance.Verbose("PART", "RO1:" + PhysActor.Orientation.ToString()); + //m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString()); } else { // Child prim we have to calculate it's world rotationwel LLQuaternion resultingrotation = GetWorldRotation(); PhysActor.Orientation = new Quaternion(resultingrotation.W, resultingrotation.X, resultingrotation.Y, resultingrotation.Z); - //MainLog.Instance.Verbose("PART", "RO2:" + PhysActor.Orientation.ToString()); + //m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString()); } m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); //} @@ -1554,14 +1554,13 @@ namespace OpenSim.Region.Environment.Scenes // Are we the owner? if (AgentID == OwnerID) { - MainLog.Instance.Verbose("PERMISSIONS", - "field: " + field.ToString() + ", mask: " + mask.ToString() + " addRemTF: " + - addRemTF.ToString()); + m_log.Info("[PERMISSIONS]: field: " + field.ToString() + ", mask: " + mask.ToString() + " addRemTF: " + + addRemTF.ToString()); //Field 8 = EveryoneMask if (field == (byte) 8) { - MainLog.Instance.Verbose("PERMISSIONS", "Left over: " + (OwnerMask - EveryoneMask)); + m_log.Info("[PERMISSIONS]: Left over: " + (OwnerMask - EveryoneMask)); if (addRemTF == (byte) 0) { //EveryoneMask = (uint)0; @@ -1751,7 +1750,7 @@ namespace OpenSim.Region.Environment.Scenes public void PhysicsOutOfBounds(PhysicsVector pos) { - MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds."); + m_log.Info("[PHYSICS]: Physical Object went out of bounds."); RemFlag(LLObject.ObjectFlags.Physics); DoPhysicsPropertyUpdate(false, true); m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 659a1f5015..5c33dfc513 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -39,6 +39,8 @@ namespace OpenSim.Region.Environment.Scenes { public class ScenePresence : EntityBase { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public static AvatarAnimations Animations; public static byte[] DefaultTexture; public LLUUID currentParcelUUID = LLUUID.Zero; @@ -345,7 +347,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (KeyNotFoundException) { - MainLog.Instance.Warn("AVATAR", "KeyNotFound Exception playing avatar stand animation"); + m_log.Warn("[AVATAR]: KeyNotFound Exception playing avatar stand animation"); } m_animationSeqs.Add(1); @@ -933,7 +935,7 @@ namespace OpenSim.Region.Environment.Scenes } else { - MainLog.Instance.Warn("Sit requested on unknown object: " + targetID.ToString()); + m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); } SendSitResponse(remoteClient, targetID, offset); } @@ -1047,7 +1049,7 @@ namespace OpenSim.Region.Environment.Scenes } catch { - MainLog.Instance.Warn("AVATAR", "SetMovementAnimation for avatar failed. Attempting recovery..."); + m_log.Warn("[AVATAR]: SetMovementAnimation for avatar failed. Attempting recovery..."); m_animations[0] = anim; m_animationSeqs[0] = seq; SendAnimPack(); @@ -1184,13 +1186,13 @@ namespace OpenSim.Region.Environment.Scenes //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); //bool colliding = (m_physicsActor.IsColliding==true); //if (controlland) - // MainLog.Instance.Verbose("AGENT","landCommand"); + // m_log.Info("[AGENT]: landCommand"); //if (colliding ) - // MainLog.Instance.Verbose("AGENT","colliding"); + // m_log.Info("[AGENT]: colliding"); //if (m_physicsActor.Flying && colliding && controlland) //{ // StopFlying(); - // MainLog.Instance.Verbose("AGENT", "Stop FLying"); + // m_log.Info("[AGENT]: Stop FLying"); //} } else diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs index d7818060a9..5d432f558f 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs @@ -33,7 +33,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting { public interface ScriptEngineInterface { - void InitializeEngine(Scene Sceneworld, LogBase logger); + void InitializeEngine(Scene Sceneworld); void Shutdown(); // void StartScript(string ScriptID, IScriptHost ObjectID); } diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs index 74f9358ced..b52b2e9cf3 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs @@ -35,12 +35,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting { public class ScriptEngineLoader { - private LogBase m_log; - - public ScriptEngineLoader(LogBase logger) - { - m_log = logger; - } + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public ScriptEngineInterface LoadScriptEngine(string EngineName) { @@ -54,7 +49,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting } catch (Exception e) { - m_log.Error("ScriptEngine", + m_log.Error("[ScriptEngine]: " + "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString()); } @@ -88,7 +83,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting //} //catch (Exception e) //{ - // m_log.Error("ScriptEngine", "Error loading assembly \String.Empty + FileName + "\": " + e.ToString()); + // m_log.Error("[ScriptEngine]: Error loading assembly \String.Empty + FileName + "\": " + e.ToString()); //} @@ -105,7 +100,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting //} //catch (Exception e) //{ - // m_log.Error("ScriptEngine", "Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); + // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); //} ScriptEngineInterface ret; @@ -115,7 +110,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting //} //catch (Exception e) //{ - // m_log.Error("ScriptEngine", "Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); + // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); //} return ret; diff --git a/OpenSim/Region/Environment/StorageManager.cs b/OpenSim/Region/Environment/StorageManager.cs index 1c41373495..f15bbdbfab 100644 --- a/OpenSim/Region/Environment/StorageManager.cs +++ b/OpenSim/Region/Environment/StorageManager.cs @@ -35,6 +35,8 @@ namespace OpenSim.Region.Environment { public class StorageManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private IRegionDataStore m_dataStore; public IRegionDataStore DataStore @@ -49,7 +51,7 @@ namespace OpenSim.Region.Environment public StorageManager(string dllName, string connectionstring, bool persistPrimInventories) { - MainLog.Instance.Verbose("DATASTORE", "Attempting to load " + dllName); + m_log.Info("[DATASTORE]: Attempting to load " + dllName); Assembly pluginAssembly = Assembly.LoadFrom(dllName); foreach (Type pluginType in pluginAssembly.GetTypes()) @@ -66,7 +68,7 @@ namespace OpenSim.Region.Environment m_dataStore = plug; - MainLog.Instance.Verbose("DATASTORE", "Added IRegionDataStore Interface"); + m_log.Info("[DATASTORE]: Added IRegionDataStore Interface"); } } } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 6c18540a78..f919276610 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -51,9 +51,9 @@ namespace SimpleApp private string m_userPlugin = "OpenSim.Framework.Data.SQLite.dll"; private string m_inventoryPlugin = "OpenSim.Framework.Data.SQLite.dll"; - protected override LogBase CreateLog() + protected override ConsoleBase CreateConsole() { - return new LogBase(null, "SimpleApp", this, true); + return new ConsoleBase("SimpleApp", this); } protected override void Initialize() @@ -64,12 +64,12 @@ namespace SimpleApp LocalAssetServer assetServer = new LocalAssetServer(); - m_assetCache = new AssetCache(assetServer, m_log); + m_assetCache = new AssetCache(assetServer); } public void Run() { - StartLog(); + StartConsole(); StartUp(); LocalInventoryService inventoryService = new LocalInventoryService(); @@ -94,7 +94,7 @@ namespace SimpleApp m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); - m_log.Notice(m_log.LineInfo); + m_console.Notice(m_console.LineInfo); IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), (int) m_networkServersInfo.HttpListenerPort); @@ -104,7 +104,7 @@ namespace SimpleApp UDPServer udpServer; - m_moduleLoader = new ModuleLoader(m_log, m_config); + m_moduleLoader = new ModuleLoader(m_config); m_moduleLoader.LoadDefaultSharedModules(); Scene scene = SetupScene(regionInfo, out udpServer, false); @@ -170,8 +170,8 @@ namespace SimpleApp scene.AddEntity(fileObject); } - m_log.Notice("Press enter to quit."); - m_log.ReadLine(); + m_console.Notice("Press enter to quit."); + m_console.ReadLine(); } protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, @@ -182,7 +182,7 @@ namespace SimpleApp return new MyWorld(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer, - new ModuleLoader(m_log, m_config), true, false); + new ModuleLoader(m_config), true, false); } protected override StorageManager CreateStorageManager(string connectionstring) @@ -211,6 +211,8 @@ namespace SimpleApp private static void Main(string[] args) { + log4net.Config.XmlConfigurator.Configure(); + Program app = new Program(); app.Run(); diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs index b625f43f0c..03d478ffa6 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs @@ -35,6 +35,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp { public class CSharpScriptEngine : IScriptCompiler { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public string FileExt() { return ".cs"; @@ -58,10 +60,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp if (compilerResults.Errors.Count > 0) { - MainLog.Instance.Error("Compile errors"); + m_log.Error("Compile errors"); foreach (CompilerError error in compilerResults.Errors) { - MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); + m_log.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); } } else diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs index bc5c413e6a..dbe0dca5c9 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs @@ -35,6 +35,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript { public class JScriptEngine : IScriptCompiler { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public string FileExt() { return ".js"; @@ -58,10 +60,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript if (compilerResults.Errors.Count > 0) { - MainLog.Instance.Error("Compile errors"); + m_log.Error("Compile errors"); foreach (CompilerError error in compilerResults.Errors) { - MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); + m_log.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); } } else diff --git a/OpenSim/Region/ExtensionsScriptModule/Script.cs b/OpenSim/Region/ExtensionsScriptModule/Script.cs index 0555277fa7..d9d569b60c 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Script.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Script.cs @@ -53,12 +53,12 @@ namespace OpenSim.Region.ExtensionsScriptModule private void events_OnNewPresence(ScenePresence presence) { - script.logger.Verbose("TESTSCRIPT", "Hello " + presence.Firstname.ToString() + "!"); + script.Log.Info("[TESTSCRIPT]: Hello " + presence.Firstname.ToString() + "!"); } private void events_OnFrame() { - //script.logger.Verbose("TESTSCRIPT", "Hello World!"); + //script.logger.Info("[TESTSCRIPT]: Hello World!"); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs index af54a4eec3..e90bfc1b62 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs @@ -36,23 +36,26 @@ namespace OpenSim.Region.ExtensionsScriptModule /// public class ScriptInfo { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + // Reference to world.eventsManager provided for convenience public EventManager events; // The main world public Scene world; - // The console - public LogBase logger; - // API Access public ScriptAPI api; + public log4net.ILog Log + { + get { return m_log; } + } + public ScriptInfo(Scene scene) { world = scene; events = world.EventManager; - logger = MainLog.Instance; api = new ScriptAPI(world, LLUUID.Zero); } diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs index b3a0d4f652..0f50358040 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs @@ -45,6 +45,8 @@ namespace OpenSim.Region.ExtensionsScriptModule /// Avoid at all costs. This should ONLY be used for LSL. internal class ScriptInterpretedAPI { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + protected Key m_object; protected Scene m_scene; @@ -109,7 +111,7 @@ namespace OpenSim.Region.ExtensionsScriptModule { //Dont do anything! } - MainLog.Instance.Warn("script", + m_log.Warn("[script]: " + "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); return; } @@ -117,7 +119,7 @@ namespace OpenSim.Region.ExtensionsScriptModule [Obsolete("Unimplemented")] public void osAdjustSoundVolume(float volume) { - MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)"); + m_log.Warn("[script]: Unimplemented function called by script: osAdjustSoundVolume(float volume)"); return; } diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs index d080ab826f..6c2d94031a 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs @@ -38,6 +38,8 @@ namespace OpenSim.Region.ExtensionsScriptModule { public class ScriptManager : IRegionModule, IExtensionScriptModule { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private readonly List scripts = new List(); private Scene m_scene; private readonly Dictionary compilers = new Dictionary(); @@ -48,12 +50,12 @@ namespace OpenSim.Region.ExtensionsScriptModule { ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. - MainLog.Instance.Verbose("SCRIPT", "Loading " + script.Key); + m_log.Info("[SCRIPT]: Loading " + script.Key); script.Value.Initialise(scriptInfo); scripts.Add(script.Value); } - MainLog.Instance.Verbose("SCRIPT", string.Format("Finished loading {0} script(s)", compiledscripts.Count)); + m_log.Info("[SCRIPT]: " + string.Format("Finished loading {0} script(s)", compiledscripts.Count)); } public ScriptManager() @@ -71,7 +73,7 @@ namespace OpenSim.Region.ExtensionsScriptModule public void Initialise(Scene scene, IConfigSource config) { - MainLog.Instance.Verbose("SCRIPTMODULE", "Initialising Extensions Scripting Module"); + m_log.Info("[SCRIPTMODULE]: Initialising Extensions Scripting Module"); m_scene = scene; m_scene.RegisterModuleInterface(this); @@ -118,14 +120,14 @@ namespace OpenSim.Region.ExtensionsScriptModule break; default: - MainLog.Instance.Error("Unknown script command"); + m_log.Error("Unknown script command"); break; } } public bool AddPreCompiledScript(IScript script) { - MainLog.Instance.Verbose("SCRIPT", "Loading script " + script.Name); + m_log.Info("[SCRIPT]: Loading script " + script.Name); ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. script.Initialise(scriptInfo); diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs index b76fbbf3c6..919910cc25 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs @@ -55,4 +55,4 @@ using System.Runtime.InteropServices; // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): -[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file +[assembly : AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index f42fdf6151..27ae490f79 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs @@ -81,6 +81,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin /// public class BulletXMaths { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + //Vector3 public static Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector) { @@ -311,7 +313,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin bool needsCollision = base.NeedsCollision(bodyA, bodyB); - //MainLog.Instance.Debug("BulletX", "A collision was detected between {0} and {1} --> {2}", nameA, nameB, + //m_log.Debug("[BulletX]: A collision was detected between {0} and {1} --> {2}", nameA, nameB, //needsCollision); diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index a4ac54f504..acaa389bd2 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs @@ -38,6 +38,8 @@ namespace OpenSim.Region.Physics.Manager /// public class PhysicsPluginManager { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private Dictionary _PhysPlugins = new Dictionary(); private Dictionary _MeshPlugins = new Dictionary(); @@ -60,25 +62,25 @@ namespace OpenSim.Region.Physics.Manager IMesher meshEngine = null; if (_MeshPlugins.ContainsKey(meshEngineName)) { - MainLog.Instance.Verbose("PHYSICS", "creating meshing engine " + meshEngineName); + m_log.Info("[PHYSICS]: creating meshing engine " + meshEngineName); meshEngine = _MeshPlugins[meshEngineName].GetMesher(); } else { - MainLog.Instance.Warn("PHYSICS", "couldn't find meshingEngine: {0}", meshEngineName); + m_log.Warn(String.Format("[PHYSICS]: couldn't find meshingEngine: {0}", meshEngineName)); throw new ArgumentException(String.Format("couldn't find meshingEngine: {0}", meshEngineName)); } if (_PhysPlugins.ContainsKey(physEngineName)) { - MainLog.Instance.Verbose("PHYSICS", "creating " + physEngineName); + m_log.Info("[PHYSICS]: creating " + physEngineName); PhysicsScene result = _PhysPlugins[physEngineName].GetScene(); result.Initialise(meshEngine); return result; } else { - MainLog.Instance.Warn("PHYSICS", "couldn't find physicsEngine: {0}", physEngineName); + m_log.Warn(String.Format("[PHYSICS]: couldn't find physicsEngine: {0}", physEngineName)); throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", physEngineName)); } } @@ -89,7 +91,7 @@ namespace OpenSim.Region.Physics.Manager IMeshingPlugin plugHard; plugHard = new ZeroMesherPlugin(); _MeshPlugins.Add(plugHard.GetName(), plugHard); - MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plugHard.GetName()); + m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName()); // And now walk all assemblies (DLLs effectively) and see if they are home // of a plugin that is of interest for us @@ -120,7 +122,7 @@ namespace OpenSim.Region.Physics.Manager (IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Init(); _PhysPlugins.Add(plug.GetName(), plug); - MainLog.Instance.Verbose("PHYSICS", "Added physics engine: " + plug.GetName()); + m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); } Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true); @@ -130,7 +132,7 @@ namespace OpenSim.Region.Physics.Manager IMeshingPlugin plug = (IMeshingPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); _MeshPlugins.Add(plug.GetName(), plug); - MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plug.GetName()); + m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); } physTypeInterface = null; @@ -147,11 +149,11 @@ namespace OpenSim.Region.Physics.Manager { if (isWarning) { - MainLog.Instance.Warn("PHYSICS", message); + m_log.Warn("[PHYSICS]: " + message); } else { - MainLog.Instance.Verbose("PHYSICS", message); + m_log.Info("[PHYSICS]: " + message); } } @@ -171,4 +173,4 @@ namespace OpenSim.Region.Physics.Manager string GetName(); IMesher GetMesher(); } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 37481f166e..bd2ad9918a 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +using System; using Axiom.Math; using OpenSim.Framework; using OpenSim.Framework.Console; @@ -35,6 +36,8 @@ namespace OpenSim.Region.Physics.Manager public abstract class PhysicsScene { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + // The only thing that should register for this event is the InnerScene // Anything else could cause problems. @@ -92,7 +95,7 @@ namespace OpenSim.Region.Physics.Manager public override PhysicsActor AddAvatar(string avName, PhysicsVector position) { - MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : AddAvatar({0})", position); + m_log.Info(String.Format("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position)); return PhysicsActor.Null; } @@ -107,7 +110,7 @@ namespace OpenSim.Region.Physics.Manager /* public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) { - MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); + m_log.Info(String.Format("NullPhysicsScene : AddPrim({0},{1})", position, size)); return PhysicsActor.Null; } */ @@ -121,7 +124,7 @@ namespace OpenSim.Region.Physics.Manager public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation, bool isPhysical) { - MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : AddPrim({0},{1})", position, size); + m_log.Info(String.Format("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size)); return PhysicsActor.Null; } @@ -131,20 +134,19 @@ namespace OpenSim.Region.Physics.Manager public override float Simulate(float timeStep) { - m_workIndicator = (m_workIndicator + 1)%10; + m_workIndicator = (m_workIndicator + 1) % 10; - //MainLog.Instance.SetStatus(m_workIndicator.ToString()); return 0f; } public override void GetResults() { - MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : GetResults()"); + m_log.Info("[PHYSICS]: NullPhysicsScene : GetResults()"); } public override void SetTerrain(float[] heightMap) { - MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); + m_log.Info(String.Format("[PHYSICS]: NullPhysicsScene : SetTerrain({0} items)", heightMap.Length)); } public override void DeleteTerrain() diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 3217dd8a45..d4c9926b4c 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -53,6 +53,8 @@ namespace OpenSim.Region.Physics.Meshing public class Meshmerizer : IMesher { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + // Setting baseDir to a path will enable the dumping of raw files // raw files can be imported by blender so a visual inspection of the results can be done // const string baseDir = "rawFiles"; @@ -101,7 +103,6 @@ namespace OpenSim.Region.Physics.Meshing return influenced; } - private static void InsertVertices(List vertices, int usedForSeed, List triangles) { // This is a variant of the delaunay algorithm @@ -174,7 +175,6 @@ namespace OpenSim.Region.Physics.Meshing } } - private static Mesh CreateBoxMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size) // Builds the z (+ and -) surfaces of a box shaped prim { @@ -236,7 +236,7 @@ namespace OpenSim.Region.Physics.Meshing // Calculated separately to avoid errors cutHull.AddVertex(legEnd); - MainLog.Instance.Debug("Starting cutting of the hollow shape from the prim {1}", 0, primName); + m_log.Debug(String.Format("Starting cutting of the hollow shape from the prim {1}", 0, primName)); SimpleHull cuttedHull = SimpleHull.SubtractHull(outerHull, cutHull); outerHull = cuttedHull; diff --git a/OpenSim/Region/Physics/Meshing/SimpleHull.cs b/OpenSim/Region/Physics/Meshing/SimpleHull.cs index 4532bdae21..92098603df 100644 --- a/OpenSim/Region/Physics/Meshing/SimpleHull.cs +++ b/OpenSim/Region/Physics/Meshing/SimpleHull.cs @@ -42,6 +42,8 @@ namespace OpenSim.Region.Physics.Meshing // is defined by the hull lies inside or outside the simplex chain public class SimpleHull { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private List vertices = new List(); private List holeVertices = new List(); // Only used, when the hull is hollow @@ -243,9 +245,9 @@ namespace OpenSim.Region.Physics.Meshing SimpleHull otherHullClone = otherHull.Clone(); bool intersects = false; - MainLog.Instance.Debug("State before intersection detection"); - MainLog.Instance.Debug("The baseHull is:\n{1}", 0, baseHullClone.ToString()); - MainLog.Instance.Debug("The otherHull is:\n{1}", 0, otherHullClone.ToString()); + m_log.Debug("State before intersection detection"); + m_log.Debug(String.Format("The baseHull is:\n{1}", 0, baseHullClone.ToString())); + m_log.Debug(String.Format("The otherHull is:\n{1}", 0, otherHullClone.ToString())); { int iBase, iOther; @@ -274,8 +276,8 @@ namespace OpenSim.Region.Physics.Meshing } } - MainLog.Instance.Debug("State after intersection detection for the base hull"); - MainLog.Instance.Debug("The baseHull is:\n{1}", 0, baseHullClone.ToString()); + m_log.Debug("State after intersection detection for the base hull"); + m_log.Debug(String.Format("The baseHull is:\n{1}", 0, baseHullClone.ToString())); { int iOther, iBase; @@ -303,8 +305,8 @@ namespace OpenSim.Region.Physics.Meshing } } - MainLog.Instance.Debug("State after intersection detection for the base hull"); - MainLog.Instance.Debug("The otherHull is:\n{1}", 0, otherHullClone.ToString()); + m_log.Debug("State after intersection detection for the base hull"); + m_log.Debug(String.Format("The otherHull is:\n{1}", 0, otherHullClone.ToString())); bool otherIsInBase = baseHullClone.containsPointsFrom(otherHullClone); @@ -387,7 +389,7 @@ namespace OpenSim.Region.Physics.Meshing done = true; } - MainLog.Instance.Debug("The resulting Hull is:\n{1}", 0, result.ToString()); + m_log.Debug(String.Format("The resulting Hull is:\n{1}", 0, result.ToString())); return result; } diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index a21b7eb499..98069a0818 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -56,6 +56,8 @@ namespace OpenSim.Region.Physics.OdePlugin } public class OdeCharacter : PhysicsActor { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private PhysicsVector _position; private d.Vector3 _zeroPosition; private d.Matrix3 m_StandUpRotation; @@ -357,7 +359,7 @@ namespace OpenSim.Region.Physics.OdePlugin //capsuleradius = 0.2f; CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.52f))); // subtract 43% of the size - OpenSim.Framework.Console.MainLog.Instance.Verbose("SIZE", CAPSULE_LENGTH.ToString()); + m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); d.BodyDestroy(Body); _parent_scene.waitForSpaceUnlock(_parent_scene.space); @@ -440,7 +442,7 @@ namespace OpenSim.Region.Physics.OdePlugin //d.QfromR( //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068, // - //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICSAV", "Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); + //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); //standupStraight(); @@ -479,7 +481,7 @@ namespace OpenSim.Region.Physics.OdePlugin d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); - //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICSAV", "Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); + //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); } public override PhysicsVector Force diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 93ba29e721..690e9d317c 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -37,6 +37,8 @@ namespace OpenSim.Region.Physics.OdePlugin { public class OdePrim : PhysicsActor { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public PhysicsVector _position; private PhysicsVector _velocity; private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); @@ -530,7 +532,7 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Failed to load a sphere bad size"); + m_log.Info("[PHYSICS]: Failed to load a sphere bad size"); _parent_scene.waitForSpaceUnlock(m_targetSpace); prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); } @@ -683,7 +685,7 @@ namespace OpenSim.Region.Physics.OdePlugin { lock (m_forcelist) { - //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "dequeing forcelist"); + //m_log.Info("[PHYSICS]: dequeing forcelist"); if (IsPhysical) { PhysicsVector iforce = new PhysicsVector(); @@ -747,7 +749,7 @@ namespace OpenSim.Region.Physics.OdePlugin get { return _position; } set { _position = value; - //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", _position.ToString()); + //m_log.Info("[PHYSICS]: " + _position.ToString()); } } @@ -824,7 +826,7 @@ namespace OpenSim.Region.Physics.OdePlugin { m_forcelist.Add(force); m_taintforce = true; - //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Added Force:" + force.ToString() + " to prim at " + Position.ToString()); + //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); } public override PhysicsVector RotationalVelocity diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index bff2c80edf..9cf6d5049a 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -44,6 +44,8 @@ namespace OpenSim.Region.Physics.OdePlugin /// public class OdePlugin : IPhysicsPlugin { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private OdeScene _mScene; public OdePlugin() @@ -76,6 +78,8 @@ namespace OpenSim.Region.Physics.OdePlugin public class OdeScene : PhysicsScene { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + // TODO: this should be hard-coded in some common place private const uint m_regionWidth = 256; private const uint m_regionHeight = 256; @@ -284,7 +288,7 @@ namespace OpenSim.Region.Physics.OdePlugin //if (id == d.GeomClassID.TriMeshClass) //{ - // MainLog.Instance.Verbose("near: A collision was detected between {1} and {2}", 0, name1, name2); + // m_log.Info("near: A collision was detected between {1} and {2}", 0, name1, name2); //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); //} @@ -296,8 +300,7 @@ namespace OpenSim.Region.Physics.OdePlugin } catch (SEHException) { - MainLog.Instance.Error("PHYSICS", - "The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim."); + m_log.Error("[PHYSICS]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim."); base.TriggerPhysicsBasedRestart(); } @@ -352,7 +355,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (contacts[i].depth >= 1.00f) { - //MainLog.Instance.Debug("PHYSICS",contacts[i].depth.ToString()); + //m_log.Debug("[PHYSICS]: " +contacts[i].depth.ToString()); } //If you interpenetrate a prim with an agent @@ -405,7 +408,7 @@ namespace OpenSim.Region.Physics.OdePlugin } if (contacts[i].depth >= 1.00f) { - //OpenSim.Framework.Console.MainLog.Instance.Verbose("P", contacts[i].depth.ToString()); + //m_log.Info("[P]: " + contacts[i].depth.ToString()); if ((p2.PhysicsActorType == (int) ActorTypes.Agent && p1.PhysicsActorType == (int) ActorTypes.Unknown) || (p1.PhysicsActorType == (int) ActorTypes.Agent && @@ -654,9 +657,8 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - MainLog.Instance.Verbose("Physics", - "Invalid Scene passed to 'removeprim from scene':" + - ((OdePrim) prim).m_targetSpace.ToString()); + m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + + ((OdePrim) prim).m_targetSpace.ToString()); } } } @@ -678,9 +680,8 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - MainLog.Instance.Verbose("Physics", - "Invalid Scene passed to 'removeprim from scene':" + - ((OdePrim) prim).m_targetSpace.ToString()); + m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + + ((OdePrim) prim).m_targetSpace.ToString()); } } } @@ -742,9 +743,8 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - MainLog.Instance.Verbose("Physics", - "Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() + - " Geom:" + geom.ToString()); + m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() + + " Geom:" + geom.ToString()); } } else @@ -761,9 +761,8 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - MainLog.Instance.Verbose("Physics", - "Invalid Scene passed to 'recalculatespace':" + - sGeomIsIn.ToString() + " Geom:" + geom.ToString()); + m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + + sGeomIsIn.ToString() + " Geom:" + geom.ToString()); } } } @@ -787,9 +786,8 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - MainLog.Instance.Verbose("Physics", - "Invalid Scene passed to 'recalculatespace':" + - currentspace.ToString() + " Geom:" + geom.ToString()); + m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + + currentspace.ToString() + " Geom:" + geom.ToString()); } } } @@ -807,9 +805,8 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - MainLog.Instance.Verbose("Physics", - "Invalid Scene passed to 'recalculatespace':" + - currentspace.ToString() + " Geom:" + geom.ToString()); + m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + + currentspace.ToString() + " Geom:" + geom.ToString()); } } else @@ -826,9 +823,8 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - MainLog.Instance.Verbose("Physics", - "Invalid Scene passed to 'recalculatespace':" + - sGeomIsIn.ToString() + " Geom:" + geom.ToString()); + m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + + sGeomIsIn.ToString() + " Geom:" + geom.ToString()); } } } @@ -876,7 +872,7 @@ namespace OpenSim.Region.Physics.OdePlugin IntPtr locationbasedspace =IntPtr.Zero; int[] xyspace = calculateSpaceArrayItemFromPos(pos); - //MainLog.Instance.Verbose("Physics", "Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); + //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); locationbasedspace = staticPrimspace[xyspace[0], xyspace[1]]; //locationbasedspace = space; @@ -970,7 +966,7 @@ namespace OpenSim.Region.Physics.OdePlugin name2 = "null"; } - MainLog.Instance.Verbose("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2); + m_log.Info("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2); */ return 1; } @@ -984,19 +980,20 @@ namespace OpenSim.Region.Physics.OdePlugin { name1 = "null"; } + if (!geom_name_map.TryGetValue(refObject, out name2)) { name2 = "null"; } -// MainLog.Instance.Verbose("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex); +// m_log.Info("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex); d.Vector3 v0 = new d.Vector3(); d.Vector3 v1 = new d.Vector3(); d.Vector3 v2 = new d.Vector3(); d.GeomTriMeshGetTriangle(trimesh, 0, ref v0, ref v1, ref v2); -// MainLog.Instance.Debug("Triangle {0} is <{1},{2},{3}>, <{4},{5},{6}>, <{7},{8},{9}>", triangleIndex, v0.X, v0.Y, v0.Z, v1.X, v1.Y, v1.Z, v2.X, v2.Y, v2.Z); +// m_log.Debug("Triangle {0} is <{1},{2},{3}>, <{4},{5},{6}>, <{7},{8},{9}>", triangleIndex, v0.X, v0.Y, v0.Z, v1.X, v1.Y, v1.Z, v2.X, v2.Y, v2.Z); return 1; } @@ -1105,19 +1102,16 @@ namespace OpenSim.Region.Physics.OdePlugin } catch (StackOverflowException) { - MainLog.Instance.Error("PHYSICS", - "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim."); + m_log.Error("[PHYSICS]: The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim."); base.TriggerPhysicsBasedRestart(); } int i = 0; - // Figure out the Frames Per Second we're going at. //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size fps = (step_time/ODE_STEPSIZE) * 1000; - while (step_time > 0.0f) { foreach (OdeCharacter actor in _characters) @@ -1126,7 +1120,6 @@ namespace OpenSim.Region.Physics.OdePlugin actor.collidelock = true; } - collision_optimized(timeStep); d.WorldQuickStep(world, ODE_STEPSIZE); d.JointGroupEmpty(contactgroup); @@ -1178,8 +1171,8 @@ namespace OpenSim.Region.Physics.OdePlugin public override bool IsThreaded { - get { return (false); // for now we won't be multithreaded - } + // for now we won't be multithreaded + get { return (false); } } public float[] ResizeTerrain512NearestNeighbour(float[] heightMap) { @@ -1275,6 +1268,7 @@ namespace OpenSim.Region.Physics.OdePlugin } } } + //Flatten out the array int i = 0; for (int y = 0; y < 512; y++) diff --git a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs index 3bb71d4af5..da9f5873fd 100644 --- a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs @@ -55,4 +55,4 @@ using System.Runtime.InteropServices; // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): -[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file +[assembly : AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs index 36cb952c67..8e6d2a6945 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs @@ -55,4 +55,4 @@ using System.Runtime.InteropServices; // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): -[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file +[assembly : AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs index 8511b565ed..3a38497294 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs @@ -41,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.Common { public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript { - // // Included as base for any LSL-script that is compiled. // Any function added here will be accessible to the LSL script. But it must also be added to "LSL_BuiltIn_Commands_Interface" in "OpenSim.Region.ScriptEngine.Common" class. @@ -49,6 +48,8 @@ namespace OpenSim.Region.ScriptEngine.Common // Security note: This script will be running inside an restricted AppDomain. Currently AppDomain is not very restricted. // + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + // Object never expires public override Object InitializeLifetimeService() { @@ -112,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Common { m_LSL_Functions = LSL_Functions; - //MainLog.Instance.Notice(ScriptEngineName, "LSL_BaseClass.Start() called."); + //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called."); // Get this AppDomain's settings and display some of them. AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 242bd270cd..66475c3957 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -43,12 +43,13 @@ using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; namespace OpenSim.Region.ScriptEngine.Common { - /// /// Contains all LSL ll-functions. This class will be in Default AppDomain. /// public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private ASCIIEncoding enc = new ASCIIEncoding(); private ScriptEngineBase.ScriptEngine m_ScriptEngine; private SceneObjectPart m_host; @@ -63,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Common m_localID = localID; m_itemID = itemID; - //MainLog.Instance.Notice(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); + //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); } private DateTime m_timer = DateTime.Now; diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs index 2ed0529369..0fb8d758f6 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs @@ -26,7 +26,6 @@ * */ - using System; using System.Collections; using System.Collections.Generic; @@ -37,7 +36,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase { public class AppDomainManager : iScriptEngineFunctionModule { - // // This class does AppDomain handling and loading/unloading of scripts in it. // It is instanced in "ScriptEngine" and controlled from "ScriptManager" @@ -48,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase // 4. Unload AppDomain completely when all scripts in it has stopped // - private int maxScriptsPerAppDomain = 1; /// @@ -149,8 +146,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); - m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "AppDomain Loading: " + - AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); + m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: AppDomain Loading: " + + AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); // Return the new AppDomain @@ -183,7 +180,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase // Unload AppDomain.Unload(ads.CurrentAppDomain); #if DEBUG - m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); + m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); #endif } } @@ -191,14 +188,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } // lock } - public IScript LoadScript(string FileName) { // Find next available AppDomain to put it in AppDomainStructure FreeAppDomain = GetFreeAppDomain(); #if DEBUG - m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "Loading into AppDomain: " + FileName); + m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: Loading into AppDomain: " + FileName); #endif IScript mbrt = (IScript) @@ -220,7 +216,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase lock (freeLock) { #if DEBUG - m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "Stopping script in AppDomain"); + m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: Stopping script in AppDomain"); #endif // Check if it is current AppDomain if (currentAD.CurrentAppDomain == ad) @@ -244,6 +240,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase UnloadAppDomains(); // Outsite lock, has its own GetLock } + /// /// If set to true then threads and stuff should try to make a graceful exit /// @@ -253,6 +250,5 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase set { _PleaseShutdown = value; } } private bool _PleaseShutdown = false; - } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs index fe6dfcdef4..e99f0a72f6 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs @@ -26,7 +26,6 @@ * */ - namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase { public static class Common @@ -36,23 +35,23 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase // This class just contains some static log stuff used for debugging. - //public delegate void SendToDebugEventDelegate(string Message); - //public delegate void SendToLogEventDelegate(string Message); + //public delegate void SendToDebugEventDelegate(string message); + //public delegate void SendToLogEventDelegate(string message); //static public event SendToDebugEventDelegate SendToDebugEvent; //static public event SendToLogEventDelegate SendToLogEvent; - public static void SendToDebug(string Message) + public static void SendToDebug(string message) { //if (Debug == true) - mySE.Log.Verbose(mySE.ScriptEngineName, "Debug: " + Message); - //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); + mySE.Log.Info("[" + mySE.ScriptEngineName + "]: Debug: " + message); + //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + message); } - public static void SendToLog(string Message) + public static void SendToLog(string message) { //if (Debug == true) - mySE.Log.Verbose(mySE.ScriptEngineName, "LOG: " + Message); - //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); + mySE.Log.Info("[" + mySE.ScriptEngineName + "]: LOG: " + message); + //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + message); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index 678c3d04ec..1de010ab99 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs @@ -39,7 +39,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase [Serializable] public class EventManager : OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents, iScriptEngineFunctionModule { - // // Class is instanced in "ScriptEngine" and Uses "EventQueueManager" that is also instanced in "ScriptEngine". // This class needs a bit of explaining: @@ -65,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase // We may not want to do it because someone is controlling us and will deliver events to us if (performHookUp) { - myScriptEngine.Log.Verbose(myScriptEngine.ScriptEngineName, "Hooking up to server events"); + myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName + "]: Hooking up to server events"); myScriptEngine.World.EventManager.OnObjectGrab += touch_start; myScriptEngine.World.EventManager.OnRezScript += OnRezScript; myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; @@ -78,7 +77,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase { } - public void changed(uint localID, uint change) { // Add to queue for all scripts in localID, Object pass change. diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index e1b1b6c06e..5e06fcdc8f 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs @@ -44,7 +44,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase [Serializable] public class EventQueueManager : iScriptEngineFunctionModule { - // // Class is instanced in "ScriptEngine" and used by "EventManager" also instanced in "ScriptEngine". // @@ -256,16 +255,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase #endregion - #region " Start / stop script execution threads (ThreadClasses) " private void StartNewThreadClass() { EventQueueThreadClass eqtc = new EventQueueThreadClass(this); eventQueueThreads.Add(eqtc); staticGlobalEventQueueThreads.Add(eqtc); - m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "Started new script execution thread. Current thread count: " + eventQueueThreads.Count); - + m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Started new script execution thread. Current thread count: " + eventQueueThreads.Count); } + private void AbortThreadClass(EventQueueThreadClass threadClass) { if (eventQueueThreads.Contains(threadClass)) @@ -279,10 +277,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } catch (Exception ex) { - m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName + ":EventQueueManager", "If you see this, could you please report it to Tedd:"); - m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName + ":EventQueueManager", "Script thread execution timeout kill ended in exception: " + ex.ToString()); + m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: If you see this, could you please report it to Tedd:"); + m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: Script thread execution timeout kill ended in exception: " + ex.ToString()); } - m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count); + m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count); } #endregion @@ -334,8 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public void AddToObjectQueue(uint localID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param) { // Determine all scripts in Object and add to their queue - //myScriptEngine.m_logger.Verbose(ScriptEngineName, "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); - + //myScriptEngine.log.Info("[" + ScriptEngineName + "]: EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); // Do we have any scripts in this object at all? If not, return if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false) @@ -368,8 +365,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase { if (eventQueue.Count >= EventExecutionMaxQueueSize) { - m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event."); - m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); + m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event."); + m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); return; } @@ -456,6 +453,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } } #endregion + /// /// If set to true then threads and stuff should try to make a graceful exit /// @@ -465,6 +463,5 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase set { _PleaseShutdown = value; } } private bool _PleaseShutdown = false; - } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs index ee38306a49..afa18399a8 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs @@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase break; default: MyThreadPriority = ThreadPriority.BelowNormal; // Default - eventQueueManager.m_ScriptEngine.Log.Error("ScriptEngineBase", "Unknown priority type \"" + pri + "\" in config file. Defaulting to \"BelowNormal\"."); + eventQueueManager.m_ScriptEngine.Log.Error("[ScriptEngineBase]: Unknown priority type \"" + pri + "\" in config file. Defaulting to \"BelowNormal\"."); break; } @@ -137,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } catch (Exception) { - //myScriptEngine.Log.Verbose(ScriptEngineName, "EventQueueManager Exception killing worker thread: " + e.ToString()); + //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Exception killing worker thread: " + e.ToString()); } } } @@ -147,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase /// private void EventQueueThreadLoop() { - //myScriptEngine.m_logger.Verbose(ScriptEngineName, "EventQueueManager Worker thread spawned"); + //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread spawned"); try { while (true) @@ -196,7 +196,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase else { // Something in queue, process - //myScriptEngine.m_logger.Verbose(ScriptEngineName, "Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName); + //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName); // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD lock (eventQueueManager.queueLock) @@ -228,12 +228,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase try { #if DEBUG - eventQueueManager.m_ScriptEngine.Log.Debug(ScriptEngineName, - "Executing event:\r\n" - + "QIS.localID: " + QIS.localID - + ", QIS.itemID: " + QIS.itemID - + ", QIS.functionName: " + - QIS.functionName); + eventQueueManager.m_ScriptEngine.Log.Debug("[" + ScriptEngineName + "]: " + + "Executing event:\r\n" + + "QIS.localID: " + QIS.localID + + ", QIS.itemID: " + QIS.itemID + + ", QIS.functionName: " + + QIS.functionName); #endif LastExecutionStarted = DateTime.Now.Ticks; KillCurrentScript = false; @@ -284,9 +284,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase //else //{ // T oconsole - eventQueueManager.m_ScriptEngine.Log.Error(ScriptEngineName, - "Unable to send text in-world:\r\n" + - text); + eventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName + "]: " + + "Unable to send text in-world:\r\n" + + text); } finally { @@ -309,17 +309,17 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } catch (ThreadAbortException tae) { - eventQueueManager.m_ScriptEngine.Log.Notice(ScriptEngineName, "ThreadAbortException while executing function."); + eventQueueManager.m_ScriptEngine.Log.Info("[" + ScriptEngineName + "]: ThreadAbortException while executing function."); } catch (Exception e) { - eventQueueManager.m_ScriptEngine.Log.Error(ScriptEngineName, "Exception in EventQueueThreadLoop: " + e.ToString()); + eventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName + "]: Exception in EventQueueThreadLoop: " + e.ToString()); } } // while } // try catch (ThreadAbortException) { - //myScriptEngine.Log.Verbose(ScriptEngineName, "EventQueueManager Worker thread killed: " + tae.Message); + //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread killed: " + tae.Message); } } diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs index 4a119f051b..ab4ea04914 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs @@ -87,7 +87,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase private void StopMaintenanceThread() { #if DEBUG - m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "StopMaintenanceThread() called"); + m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called"); #endif PleaseShutdown = true; Thread.Sleep(100); @@ -103,7 +103,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } catch (Exception ex) { - m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Exception stopping maintenence thread: " + ex.ToString()); + m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception stopping maintenence thread: " + ex.ToString()); } } @@ -113,8 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public void MaintenanceLoop() { if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms) - m_ScriptEngine.Log.Warn(m_ScriptEngine.ScriptEngineName, - "Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run."); + m_ScriptEngine.Log.Warn("[" + m_ScriptEngine.ScriptEngineName + "]: " + + "Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run."); long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks; long Last_ReReadConfigFilens = DateTime.Now.Ticks; @@ -170,7 +170,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } catch (Exception ex) { - m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: " + ex.ToString()); + m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: " + ex.ToString()); Thread.Sleep(5000); } } diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs index f09e63106f..78d9f7d9a4 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs @@ -26,7 +26,6 @@ * */ - using System; using System.IO; using Nini.Config; @@ -45,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase [Serializable] public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public Scene World; public EventManager m_EventManager; // Handles and queues incoming events from OpenSim public EventQueueManager m_EventQueueManager; // Executes events, handles script threads @@ -73,7 +74,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public abstract ScriptManager _GetScriptManager(); - private LogBase m_log; + public log4net.ILog Log + { + get { return m_log; } + } public ScriptEngine() { @@ -81,25 +85,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase Common.mySE = this; } - public LogBase Log - { - get { return m_log; } - } - - public void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool HookUpToServer, ScriptManager newScriptManager) + public void InitializeEngine(Scene Sceneworld, IConfigSource config, bool HookUpToServer, ScriptManager newScriptManager) { World = Sceneworld; - m_log = logger; ConfigSource = config; - Log.Verbose(ScriptEngineName, "ScriptEngine initializing"); + m_log.Info("[" + ScriptEngineName + "]: ScriptEngine initializing"); // Make sure we have config if (ConfigSource.Configs[ScriptEngineName] == null) ConfigSource.AddConfig(ScriptEngineName); ScriptConfigSource = ConfigSource.Configs[ScriptEngineName]; - - //m_logger.Status(ScriptEngineName, "InitializeEngine"); + //m_log.Info("[" + ScriptEngineName + "]: InitializeEngine"); // Create all objects we'll be using m_EventQueueManager = new EventQueueManager(this); @@ -111,11 +108,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this); m_MaintenanceThread = new MaintenanceThread(this); - Log.Verbose(ScriptEngineName, "Reading configuration from config section \"" + ScriptEngineName + "\""); + m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\""); ReadConfig(); - - // Should we iterate the region for scripts that needs starting? // Or can we assume we are loaded before anything else so we can use proper events? } @@ -129,10 +124,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase { return this.m_EventManager; } + public void ReadConfig() { //#if DEBUG -// Log.Debug(ScriptEngineName, "Refreshing configuration for all modules"); +// m_log.Debug("[" + ScriptEngineName + "]: Refreshing configuration for all modules"); //#endif RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30); @@ -153,10 +149,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase if (m_AppDomainManager != null) m_AppDomainManager.ReadConfig(); if (m_ASYNCLSLCommandManager != null) m_ASYNCLSLCommandManager.ReadConfig(); if (m_MaintenanceThread != null) m_MaintenanceThread.ReadConfig(); - } - #region IRegionModule public abstract void Initialise(Scene scene, IConfigSource config); @@ -179,8 +173,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase get { return false; } } - - #endregion /// @@ -194,4 +186,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase private bool _PleaseShutdown = false; } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 6661fcc140..12d26fce38 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs @@ -249,7 +249,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase { if (LUQueue.Count >= LoadUnloadMaxQueueSize) { - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "ERROR: Load/unload queue item count is at " + LUQueue.Count + ". Config variable \"LoadUnloadMaxQueueSize\" is set to " + LoadUnloadMaxQueueSize + ", so ignoring new script."); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: ERROR: Load/unload queue item count is at " + LUQueue.Count + ". Config variable \"LoadUnloadMaxQueueSize\" is set to " + LoadUnloadMaxQueueSize + ", so ignoring new script."); return; } @@ -299,7 +299,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase Console.WriteLine("ScriptEngine: Inside ExecuteEvent for event " + FunctionName); #endif // Execute a function in the script - //m_scriptEngine.Log.Verbose(ScriptEngineName, "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); + //m_scriptEngine.Log.Info("[" + ScriptEngineName + "]: Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); //ScriptBaseInterface Script = (ScriptBaseInterface)GetScript(localID, itemID); IScript Script = GetScript(localID, itemID); if (Script == null) @@ -418,4 +418,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase private bool _PleaseShutdown = false; } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs index 38f7e7bdf9..d5031c8996 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs @@ -79,12 +79,12 @@ namespace OpenSim.Region.ScriptEngine.Common { RemoteEvents Events(); } + public interface ScriptEngine { RemoteEvents EventManager(); - void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool DontHookUp, ScriptManager newScriptManager); + void InitializeEngine(Scene Sceneworld, IConfigSource config, bool DontHookUp, ScriptManager newScriptManager); ScriptManager GetScriptManager(); } - } } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 3451cce91d..2f985e42b2 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs @@ -40,7 +40,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL { public class Compiler { - // * Uses "LSL2Converter" to convert LSL to C# if necessary. // * Compiles C#-code into an assembly // * Returns assembly name ready for AppDomain load. @@ -113,7 +112,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL AllowedCompilers.Clear(); #if DEBUG - m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Allowed languages: " + allowComp); + m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Allowed languages: " + allowComp); #endif @@ -122,18 +121,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); if (!LanguageMapping.ContainsKey(strlan)) { - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); } else { #if DEBUG - m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); + m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); #endif } AllowedCompilers.Add(strlan, true); } if (AllowedCompilers.Count == 0) - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!"); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!"); // Default language string defaultCompileLanguage = m_scriptEngine.ScriptConfigSource.GetString("DefaultCompileLanguage", "lsl").ToLower(); @@ -141,22 +140,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL // Is this language recognized at all? if (!LanguageMapping.ContainsKey(defaultCompileLanguage)) { - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, - "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\"."); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " + + "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\"."); defaultCompileLanguage = "lsl"; } // Is this language in allow-list? if (!AllowedCompilers.ContainsKey(defaultCompileLanguage)) { - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, - "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!"); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " + + "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!"); } else { #if DEBUG - m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, - "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language."); + m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: " + + "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language."); #endif // LANGUAGE IS IN ALLOW-LIST DefaultCompileLanguage = LanguageMapping[defaultCompileLanguage]; @@ -181,13 +180,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL } catch (Exception ex) { - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString()); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString()); } } foreach (string file in Directory.GetFiles(ScriptEnginesPath)) { - //m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "FILE FOUND: " + file); + //m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: FILE FOUND: " + file); if (file.ToLower().StartsWith(FilePrefix + "_compiled_") || file.ToLower().StartsWith(FilePrefix + "_source_")) @@ -198,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL } catch (Exception ex) { - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception trying delete old script file \"" + file + "\": " + ex.ToString()); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying delete old script file \"" + file + "\": " + ex.ToString()); } } @@ -313,7 +312,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL Path.Combine("ScriptEngines", FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll"); #if DEBUG - m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Starting compile of \"" + OutFile + "\"."); + m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Starting compile of \"" + OutFile + "\"."); #endif try { @@ -321,7 +320,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL } catch (Exception e) { - //m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); + //m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); throw new Exception("Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); } //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); @@ -338,7 +337,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL } catch (Exception ex) { - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString()); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString()); } } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index 720f946706..514c550a7b 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs @@ -40,7 +40,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public override void Initialise(Scene scene, IConfigSource config) { ConfigSource = config; - InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager()); + InitializeEngine(scene, config, true, GetScriptManager()); } public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 61da6ef655..c39d376d06 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -26,6 +26,7 @@ * */ /* Original code: Tedd Hansen */ + using System; using libsecondlife; using OpenSim.Framework; @@ -60,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public override void _StartScript(uint localID, LLUUID itemID, string Script) { - m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); + m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); //IScriptHost root = host.GetRoot(); @@ -85,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); #if DEBUG - m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); + m_scriptEngine.Log.Debug(String.Format("[" + m_scriptEngine.ScriptEngineName + "]: Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before)); #endif CompiledScript.Source = Script; @@ -106,7 +107,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine } catch (Exception e) { - //m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString()); + //m_scriptEngine.Log.Error("[ScriptEngine]: Error compiling script: " + e.ToString()); try { // DISPLAY ERROR INWORLD @@ -118,9 +119,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine } catch (Exception e2) { - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Error displaying error in-world: " + e2.ToString()); - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, - "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Error displaying error in-world: " + e2.ToString()); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " + + "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); } } } @@ -129,7 +130,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { // Stop script #if DEBUG - m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Stop script localID: " + localID + " LLUID: " + itemID.ToString()); + m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Stop script localID: " + localID + " LLUID: " + itemID.ToString()); #endif // Stop long command on script @@ -142,7 +143,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // TEMP: First serialize it //GetSerializedScript(localID, itemID); - try { // Get AppDomain @@ -156,10 +156,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine } catch (Exception e) { - m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + - ": " + e.ToString()); + m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + + ": " + e.ToString()); } } - } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs index 45dfd9ef6e..2a846a96e8 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine // We need to override a few things for our DotNetEngine public override void Initialise(Scene scene, IConfigSource config) { - InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager()); + InitializeEngine(scene, config, true, GetScriptManager()); } public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs index 652c24c7be..db814872b8 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs @@ -101,7 +101,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine } catch (Exception e) { - //m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString()); + //m_scriptEngine.Log.Error("[ScriptEngine]: Error compiling script: " + e.ToString()); try { // DISPLAY ERROR INWORLD @@ -113,9 +113,9 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine } catch (Exception e2) { - m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); - m_scriptEngine.Log.Error("ScriptEngine", - "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); + m_scriptEngine.Log.Error("[ScriptEngine]: Error displaying error in-world: " + e2.ToString()); + m_scriptEngine.Log.Error("[ScriptEngine]: " + + "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); } } } @@ -125,7 +125,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine // Stop script Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString()); - // Stop long command on script m_scriptEngine.m_ASYNCLSLCommandManager.RemoveScript(localID, itemID); @@ -136,7 +135,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine // TEMP: First serialize it //GetSerializedScript(localID, itemID); - try { // Get AppDomain @@ -157,7 +155,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine public override void Initialize() { - } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs b/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs index bac32cb26d..e65b8ffaf9 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs @@ -26,6 +26,7 @@ * */ /* Original code: Tedd Hansen */ + namespace OpenSim.Region.ScriptEngine.RemoteServer { public static class Common @@ -43,15 +44,15 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer public static void SendToDebug(string Message) { //if (Debug == true) - mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); + mySE.Log.Info("[ScriptEngine]: Debug: " + Message); //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); } public static void SendToLog(string Message) { //if (Debug == true) - mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); + mySE.Log.Info("[ScriptEngine]: LOG: " + Message); //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs index 047ff2e09d..971982caf9 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs @@ -26,6 +26,7 @@ * */ /* Original code: Tedd Hansen */ + using System; using libsecondlife; using OpenSim.Framework; @@ -40,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer [Serializable] internal class EventManager { - System.Collections.Generic.Dictionary remoteScript = new System.Collections.Generic.Dictionary(); TCPClient m_TCPClient; TRPC_Remote RPC; @@ -59,32 +59,28 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort); - myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events"); + myScriptEngine.Log.Info("[RemoteEngine]: Hooking up to server events"); //myScriptEngine.World.EventManager.OnObjectGrab += touch_start; myScriptEngine.World.EventManager.OnRezScript += OnRezScript; //myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; - - } void RPC_ReceiveCommand(int ID, string Command, params object[] p) { - myScriptEngine.Log.Notice("REMOTESERVER", "Received command: '" + Command + "'"); + myScriptEngine.Log.Info("[REMOTESERVER]: Received command: '" + Command + "'"); if (p != null) { for (int i = 0; i < p.Length; i++) { - myScriptEngine.Log.Notice("REMOTESERVER", "Param " + i + ": " + p[i].ToString()); + myScriptEngine.Log.Info("[REMOTESERVER]: Param " + i + ": " + p[i].ToString()); } } - } - public void OnRezScript(uint localID, LLUUID itemID, string script) { // WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID - myScriptEngine.Log.Verbose("RemoteEngine", "Creating new script (with connection)"); + myScriptEngine.Log.Info("[RemoteEngine]: Creating new script (with connection)"); // Temp for now: We have one connection only - this is hardcoded in myScriptServerID RPC.SendCommand(myScriptServerID, "OnRezScript", localID, itemID.ToString(), script); @@ -92,18 +88,15 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer //ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234); //remoteScript.Add(localID, obj); //remoteScript[localID].Events().OnRezScript(localID, itemID, script); - - } public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) { - //remoteScript[localID].Events.touch_start(localID, offsetPos, remoteClient); + //remoteScript[localID].Events.touch_start(localID, offsetPos, remoteClient); RPC.SendCommand(myScriptServerID, "touch_start", offsetPos, "How to transfer IClientAPI?"); } - // PLACEHOLDERS -- CODE WILL CHANGE! @@ -266,6 +259,5 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer //{ // remoteScript[localID].Events.http_response(localID, itemID); //} - } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs index d0dc7ab394..8d27251f27 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs @@ -26,6 +26,7 @@ * */ /* Original code: Tedd Hansen */ + using System; using Nini.Config; using OpenSim.Framework.Console; @@ -41,28 +42,27 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer [Serializable] public class ScriptEngine : IRegionModule { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + internal Scene World; internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim internal RemoteServer m_RemoteServer; // Handles connections to remote servers - private LogBase m_log; - public ScriptEngine() { Common.mySE = this; } - public LogBase Log + public log4net.ILog Log { get { return m_log; } } - public void InitializeEngine(Scene Sceneworld, LogBase logger) + public void InitializeEngine(Scene Sceneworld) { World = Sceneworld; - m_log = logger; - Log.Verbose("ScriptEngine", "RemoteEngine (Remote Script Server) initializing"); + m_log.Info("[ScriptEngine]: RemoteEngine (Remote Script Server) initializing"); // Create all objects we'll be using m_EventManager = new EventManager(this); m_RemoteServer = new RemoteServer(); @@ -74,12 +74,11 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer // We are shutting down } - #region IRegionModule public void Initialise(Scene scene, IConfigSource config) { - InitializeEngine(scene, MainLog.Instance); + InitializeEngine(scene); } public void PostInitialise() @@ -101,6 +100,5 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer } #endregion - } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs index 5125709a16..992f931d26 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs @@ -42,9 +42,10 @@ using Db4objects.Db4o.Query; namespace OpenSim.DataStore.DB4oStorage { - public class SceneObjectQuery : Predicate { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private LLUUID globalIDSearch; public SceneObjectQuery(LLUUID find) @@ -58,17 +59,14 @@ namespace OpenSim.DataStore.DB4oStorage } } - public class DB4oDataStore : IRegionDataStore { private IObjectContainer db; public void Initialise(string dbfile, string dbname) { - MainLog.Instance.Verbose("DATASTORE", "DB4O - Opening " + dbfile); + m_log.Info("[DATASTORE]: DB4O - Opening " + dbfile); db = Db4oFactory.OpenFile(dbfile); - - return; } public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) @@ -91,7 +89,7 @@ namespace OpenSim.DataStore.DB4oStorage IObjectSet result = db.Get(typeof(SceneObjectGroup)); List retvals = new List(); - MainLog.Instance.Verbose("DATASTORE", "DB4O - LoadObjects found " + result.Count.ToString() + " objects"); + m_log.Info("[DATASTORE]: DB4O - LoadObjects found " + result.Count.ToString() + " objects"); foreach (Object obj in result) { @@ -103,7 +101,6 @@ namespace OpenSim.DataStore.DB4oStorage public void StoreTerrain(double[,] ter) { - } public double[,] LoadTerrain() @@ -113,12 +110,10 @@ namespace OpenSim.DataStore.DB4oStorage public void RemoveLandObject(uint id) { - } public void StoreParcel(Land parcel) { - } public List LoadLandObjects() diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs index 28df4e7c86..6a79c8a4a9 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs @@ -43,6 +43,8 @@ namespace OpenSim.DataStore.MSSQL { public class MSSQLDataStore : IRegionDataStore { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private const string primSelect = "select * from prims"; private const string shapeSelect = "select * from primshapes"; private const string terrainSelect = "select * from terrain"; @@ -68,7 +70,7 @@ namespace OpenSim.DataStore.MSSQL ds = new DataSet(); - MainLog.Instance.Verbose("DATASTORE", "MSSQL - connecting: " + settingInitialCatalog); + m_log.Info("[DATASTORE]: MSSQL - connecting: " + settingInitialCatalog); SqlConnection conn = new SqlConnection(connectionString); SqlCommand primSelectCmd = new SqlCommand(primSelect, conn); primDa = new SqlDataAdapter(primSelectCmd); @@ -109,7 +111,7 @@ namespace OpenSim.DataStore.MSSQL } catch (Exception) { - MainLog.Instance.Verbose("DATASTORE", "Caught fill error on primshapes table"); + m_log.Info("[DATASTORE]: Caught fill error on primshapes table"); } try { @@ -117,7 +119,7 @@ namespace OpenSim.DataStore.MSSQL } catch (Exception) { - MainLog.Instance.Verbose("DATASTORE", "Caught fill error on terrain table"); + m_log.Info("[DATASTORE]: Caught fill error on terrain table"); } return; } @@ -129,18 +131,18 @@ namespace OpenSim.DataStore.MSSQL { foreach (SceneObjectPart prim in obj.Children.Values) { - MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); + m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); addPrim(prim, obj.UUID, regionUUID); } } Commit(); - // MainLog.Instance.Verbose("Dump of prims:", ds.GetXml()); + // m_log.Info("Dump of prims:", ds.GetXml()); } public void RemoveObject(LLUUID obj, LLUUID regionUUID) { - MainLog.Instance.Verbose("DATASTORE", "Removing obj: {0} from region: {1}", obj.UUID, regionUUID); + m_log.Info(String.Format("[DATASTORE]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID)); DataTable prims = ds.Tables["prims"]; DataTable shapes = ds.Tables["primshapes"]; @@ -179,7 +181,7 @@ namespace OpenSim.DataStore.MSSQL lock (ds) { DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); - MainLog.Instance.Verbose("DATASTORE", + m_log.Info("[DATASTORE]: " + "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); foreach (DataRow primRow in primsForRegion) @@ -199,7 +201,7 @@ namespace OpenSim.DataStore.MSSQL } else { - MainLog.Instance.Notice( + m_log.Info( "No shape found for prim in storage, so setting default box shape"); prim.Shape = PrimitiveBaseShape.Default; } @@ -219,7 +221,7 @@ namespace OpenSim.DataStore.MSSQL } else { - MainLog.Instance.Notice( + m_log.Info( "No shape found for prim in storage, so setting default box shape"); prim.Shape = PrimitiveBaseShape.Default; } @@ -228,11 +230,11 @@ namespace OpenSim.DataStore.MSSQL } catch (Exception e) { - MainLog.Instance.Error("DATASTORE", "Failed create prim object, exception and data follows"); - MainLog.Instance.Verbose("DATASTORE", e.ToString()); + m_log.Error("[DATASTORE]: Failed create prim object, exception and data follows"); + m_log.Info("[DATASTORE]: " + e.ToString()); foreach (DataColumn col in prims.Columns) { - MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]); + m_log.Info("[DATASTORE]: Col: " + col.ColumnName + " => " + primRow[col]); } } } @@ -245,7 +247,7 @@ namespace OpenSim.DataStore.MSSQL { int revision = Util.UnixTimeSinceEpoch(); - MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); + m_log.Info("[DATASTORE]: Storing terrain revision r" + revision.ToString()); DataTable terrain = ds.Tables["terrain"]; lock (ds) @@ -288,12 +290,12 @@ namespace OpenSim.DataStore.MSSQL } else { - MainLog.Instance.Verbose("DATASTORE", "No terrain found for region"); + m_log.Info("[DATASTORE]: No terrain found for region"); return null; } - MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); + m_log.Info("[DATASTORE]: Loaded terrain revision r" + rev.ToString()); } return terret; @@ -950,7 +952,7 @@ namespace OpenSim.DataStore.MSSQL } catch (SqlException) { - MainLog.Instance.Warn("MSSQL", "Primitives Table Already Exists"); + m_log.Warn("[MSSQL]: Primitives Table Already Exists"); } try @@ -960,7 +962,7 @@ namespace OpenSim.DataStore.MSSQL } catch (SqlException) { - MainLog.Instance.Warn("MSSQL", "Shapes Table Already Exists"); + m_log.Warn("[MSSQL]: Shapes Table Already Exists"); } try @@ -970,7 +972,7 @@ namespace OpenSim.DataStore.MSSQL } catch (SqlException) { - MainLog.Instance.Warn("MSSQL", "Terrain Table Already Exists"); + m_log.Warn("[MSSQL]: Terrain Table Already Exists"); } conn.Close(); @@ -994,7 +996,7 @@ namespace OpenSim.DataStore.MSSQL } catch (SqlException) { - MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating"); + m_log.Info("[DATASTORE]: MSSQL Database doesn't exist... creating"); InitDB(conn); } @@ -1009,14 +1011,14 @@ namespace OpenSim.DataStore.MSSQL } catch (SqlException e) { - MainLog.Instance.Verbose("DATASTORE", e.ToString()); + m_log.Info("[DATASTORE]: " + e.ToString()); } foreach (DataColumn col in createPrimTable().Columns) { if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); return false; } } @@ -1024,7 +1026,7 @@ namespace OpenSim.DataStore.MSSQL { if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); return false; } } @@ -1032,7 +1034,7 @@ namespace OpenSim.DataStore.MSSQL { if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) { - MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); + m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); return false; } } diff --git a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs index 33537fa629..219ab1cbfa 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs @@ -62,4 +62,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly : AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Tests/Inventory/TestInventory.cs b/OpenSim/Tests/Inventory/TestInventory.cs index 697b335281..e905dd8358 100644 --- a/OpenSim/Tests/Inventory/TestInventory.cs +++ b/OpenSim/Tests/Inventory/TestInventory.cs @@ -52,10 +52,10 @@ namespace OpenSim.Test.Inventory [TestFixtureSetUp] public void SetupInventoryTest() { - _agent_1_id = LLUUID.Random(); - MainLog.Instance = new LogBase("UnitTest.log", "TEST", null, false); + MainConsole.Instance = new ConsoleBase("TEST", null); + // _dbPlugin = new SQLiteInventoryStore(); _dbPlugin = new MySQLInventoryData(); _dbPlugin.Initialise(); diff --git a/OpenSim/Tests/UserServer/Stress/UserServerStressTest.cs b/OpenSim/Tests/UserServer/Stress/UserServerStressTest.cs index b060559a4c..a523d8369b 100644 --- a/OpenSim/Tests/UserServer/Stress/UserServerStressTest.cs +++ b/OpenSim/Tests/UserServer/Stress/UserServerStressTest.cs @@ -37,6 +37,8 @@ namespace OpenSim.Tests.UserServer.Stress { public static void Main(string[] args) { + log4net.Config.XmlConfigurator.Configure(); + System.Console.WriteLine("Aborting - not yet functional"); } } diff --git a/OpenSim/Tools/Export/OpenSimExport.cs b/OpenSim/Tools/Export/OpenSimExport.cs index 8f4957cc9d..8eebe35cb2 100644 --- a/OpenSim/Tools/Export/OpenSimExport.cs +++ b/OpenSim/Tools/Export/OpenSimExport.cs @@ -47,10 +47,7 @@ namespace OpenSim.Tools.Export // AddinManager.Initialize("."); // AddinManager.Registry.Update(null); - // TODO: this really sucks, but given the way we do - // logging in OpenSim, we need to establish a log up front - - MainLog.Instance = CreateLog(); + MainConsole.Instance = CreateConsole(); sman = new StorageManager( startup.GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"), @@ -61,6 +58,8 @@ namespace OpenSim.Tools.Export public static void Main(string[] args) { + log4net.Config.XmlConfigurator.Configure(); + OpenSimExport export = new OpenSimExport(InitConfig(args)); RegionInfo reg = new RegionInfo("Sara Jane", "Regions/1000-1000.xml",false); @@ -71,17 +70,11 @@ namespace OpenSim.Tools.Export } } - protected LogBase CreateLog() + protected ConsoleBase CreateConsole() { - if (!Directory.Exists(Util.logDir())) - { - Directory.CreateDirectory(Util.logDir()); - } - - return new LogBase((Path.Combine(Util.logDir(), "export.log")), "Export", null, true); + return new ConsoleBase("Export", null); } - private static IniConfigSource InitConfig(string[] args) { Console.WriteLine("Good"); diff --git a/OpenSim/Tools/OpenSim.32BitLaunch/Program.cs b/OpenSim/Tools/OpenSim.32BitLaunch/Program.cs index ba7af25671..78ba598636 100644 --- a/OpenSim/Tools/OpenSim.32BitLaunch/Program.cs +++ b/OpenSim/Tools/OpenSim.32BitLaunch/Program.cs @@ -34,6 +34,8 @@ namespace OpenSim._32BitLaunch { static void Main(string[] args) { + log4net.Config.XmlConfigurator.Configure(); + System.Console.WriteLine("32-bit OpenSim executor"); System.Console.WriteLine("-----------------------"); System.Console.WriteLine(""); diff --git a/bin/OpenSim.32BitLaunch.exe.config b/bin/OpenSim.32BitLaunch.exe.config new file mode 100644 index 0000000000..ebe552b5ff --- /dev/null +++ b/bin/OpenSim.32BitLaunch.exe.config @@ -0,0 +1,28 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/OpenSim.Grid.AssetServer.exe.config b/bin/OpenSim.Grid.AssetServer.exe.config new file mode 100644 index 0000000000..21bd6a0e6a --- /dev/null +++ b/bin/OpenSim.Grid.AssetServer.exe.config @@ -0,0 +1,28 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/OpenSim.Grid.GridServer.exe.config b/bin/OpenSim.Grid.GridServer.exe.config new file mode 100644 index 0000000000..170db91725 --- /dev/null +++ b/bin/OpenSim.Grid.GridServer.exe.config @@ -0,0 +1,28 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/OpenSim.Grid.InventoryServer.exe.config b/bin/OpenSim.Grid.InventoryServer.exe.config new file mode 100644 index 0000000000..a8e75b1835 --- /dev/null +++ b/bin/OpenSim.Grid.InventoryServer.exe.config @@ -0,0 +1,28 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/OpenSim.Grid.MessagingServer.exe.config b/bin/OpenSim.Grid.MessagingServer.exe.config new file mode 100644 index 0000000000..2e240e09b7 --- /dev/null +++ b/bin/OpenSim.Grid.MessagingServer.exe.config @@ -0,0 +1,28 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/OpenSim.Grid.ScriptServer.exe.config b/bin/OpenSim.Grid.ScriptServer.exe.config new file mode 100644 index 0000000000..5e58f587c5 --- /dev/null +++ b/bin/OpenSim.Grid.ScriptServer.exe.config @@ -0,0 +1,28 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/OpenSim.Grid.UserServer.exe.config b/bin/OpenSim.Grid.UserServer.exe.config new file mode 100644 index 0000000000..63f62ba5ff --- /dev/null +++ b/bin/OpenSim.Grid.UserServer.exe.config @@ -0,0 +1,28 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/OpenSim.exe.config b/bin/OpenSim.exe.config new file mode 100644 index 0000000000..9d2aaeda4c --- /dev/null +++ b/bin/OpenSim.exe.config @@ -0,0 +1,28 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/OpenSimExport.exe.config b/bin/OpenSimExport.exe.config new file mode 100644 index 0000000000..fce85b23b3 --- /dev/null +++ b/bin/OpenSimExport.exe.config @@ -0,0 +1,28 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/SimpleApp.exe.config b/bin/SimpleApp.exe.config new file mode 100644 index 0000000000..3156c730e6 --- /dev/null +++ b/bin/SimpleApp.exe.config @@ -0,0 +1,28 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prebuild.xml b/prebuild.xml index 7e69bea0aa..8d93e9833d 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -48,11 +48,12 @@ ../../../bin/ + - + @@ -74,6 +75,7 @@ + @@ -143,6 +145,7 @@ + @@ -174,7 +177,7 @@ - + ../../../../bin/ @@ -196,6 +199,7 @@ + @@ -220,7 +224,7 @@ - + @@ -247,6 +251,7 @@ + @@ -297,6 +302,7 @@ + @@ -322,8 +328,10 @@ - - + + + + @@ -418,6 +426,7 @@ + @@ -440,11 +449,12 @@ - - - + + + + @@ -468,9 +478,10 @@ - + + - + @@ -524,6 +535,8 @@ + + @@ -556,6 +569,7 @@ + @@ -585,6 +599,7 @@ + @@ -614,9 +629,9 @@ - + @@ -654,6 +669,7 @@ + @@ -688,9 +704,9 @@ + - - + @@ -715,6 +731,8 @@ + + @@ -741,6 +759,8 @@ + + @@ -768,6 +788,8 @@ + + @@ -807,6 +829,8 @@ + + @@ -838,6 +862,8 @@ + + @@ -868,6 +894,8 @@ + + @@ -909,6 +937,7 @@ + @@ -933,11 +962,12 @@ - + + @@ -965,6 +995,7 @@ + @@ -995,6 +1026,8 @@ + + @@ -1003,7 +1036,6 @@ - @@ -1027,6 +1059,7 @@ + @@ -1056,6 +1089,7 @@ + @@ -1088,6 +1122,7 @@ + @@ -1116,6 +1151,7 @@ + @@ -1145,6 +1181,7 @@ + @@ -1181,14 +1218,13 @@ + - - @@ -1214,9 +1250,11 @@ - + + + @@ -1249,6 +1287,8 @@ + + @@ -1286,6 +1326,7 @@ + @@ -1318,6 +1359,7 @@ + @@ -1326,7 +1368,7 @@ - + ../../../../bin/tests/stress @@ -1338,14 +1380,14 @@ - ../../../../bin/tests/stress + ../../../../bin + - @@ -1381,14 +1423,13 @@ + - - @@ -1409,6 +1450,7 @@ 1595 + @@ -1441,7 +1483,5 @@ - -