aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-03-03 18:28:30 +0000
committerJustin Clark-Casey (justincc)2010-03-03 18:28:30 +0000
commit296c68a9de2d8253bdb88c67529619398d8ec6c9 (patch)
treebad42d434472cc9d0c08636c2ba51c25408a98df /OpenSim/Services
parentMerge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-296c68a9de2d8253bdb88c67529619398d8ec6c9.zip
opensim-SC_OLD-296c68a9de2d8253bdb88c67529619398d8ec6c9.tar.gz
opensim-SC_OLD-296c68a9de2d8253bdb88c67529619398d8ec6c9.tar.bz2
opensim-SC_OLD-296c68a9de2d8253bdb88c67529619398d8ec6c9.tar.xz
Make the service loader pump out the error to the log (in red) and include the dll/interface/args that caused the problem
This gives people more of a fighting chance of finding out what went wrong
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Base/ServiceBase.cs20
-rw-r--r--OpenSim/Services/Friends/FriendsServiceBase.cs9
2 files changed, 24 insertions, 5 deletions
diff --git a/OpenSim/Services/Base/ServiceBase.cs b/OpenSim/Services/Base/ServiceBase.cs
index 8e24d85..91d5c56 100644
--- a/OpenSim/Services/Base/ServiceBase.cs
+++ b/OpenSim/Services/Base/ServiceBase.cs
@@ -26,7 +26,9 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
31using log4net;
30using Nini.Config; 32using Nini.Config;
31using OpenSim.Services.Interfaces; 33using OpenSim.Services.Interfaces;
32 34
@@ -34,6 +36,8 @@ namespace OpenSim.Services.Base
34{ 36{
35 public class ServiceBase 37 public class ServiceBase
36 { 38 {
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40
37 public T LoadPlugin<T>(string dllName) where T:class 41 public T LoadPlugin<T>(string dllName) where T:class
38 { 42 {
39 return LoadPlugin<T>(dllName, new Object[0]); 43 return LoadPlugin<T>(dllName, new Object[0]);
@@ -61,8 +65,12 @@ namespace OpenSim.Services.Base
61 { 65 {
62 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 66 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
63 67
68// m_log.DebugFormat("[SERVICE BASE]: Found assembly {0}", dllName);
69
64 foreach (Type pluginType in pluginAssembly.GetTypes()) 70 foreach (Type pluginType in pluginAssembly.GetTypes())
65 { 71 {
72// m_log.DebugFormat("[SERVICE BASE]: Found type {0}", pluginType);
73
66 if (pluginType.IsPublic) 74 if (pluginType.IsPublic)
67 { 75 {
68 if (className != String.Empty && 76 if (className != String.Empty &&
@@ -86,7 +94,15 @@ namespace OpenSim.Services.Base
86 } 94 }
87 catch (Exception e) 95 catch (Exception e)
88 { 96 {
89 Console.WriteLine("XXX Exception " + e.StackTrace); 97 List<string> strArgs = new List<string>();
98 foreach (Object arg in args)
99 strArgs.Add(arg.ToString());
100
101 m_log.Error(
102 string.Format(
103 "[SERVICE BASE]: Failed to load plugin {0} from {1} with args {2}",
104 interfaceName, dllName, string.Join(", ", strArgs.ToArray())), e);
105
90 return null; 106 return null;
91 } 107 }
92 } 108 }
@@ -95,4 +111,4 @@ namespace OpenSim.Services.Base
95 { 111 {
96 } 112 }
97 } 113 }
98} 114} \ No newline at end of file
diff --git a/OpenSim/Services/Friends/FriendsServiceBase.cs b/OpenSim/Services/Friends/FriendsServiceBase.cs
index 9858972..6ab0bff 100644
--- a/OpenSim/Services/Friends/FriendsServiceBase.cs
+++ b/OpenSim/Services/Friends/FriendsServiceBase.cs
@@ -27,13 +27,12 @@
27 27
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using log4net;
30using Nini.Config; 31using Nini.Config;
31using OpenSim.Framework; 32using OpenSim.Framework;
32using OpenSim.Data; 33using OpenSim.Data;
33using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
34using OpenSim.Services.Base; 35using OpenSim.Services.Base;
35using Nini.Config;
36using log4net;
37 36
38namespace OpenSim.Services.Friends 37namespace OpenSim.Services.Friends
39{ 38{
@@ -80,7 +79,11 @@ namespace OpenSim.Services.Friends
80 79
81 m_Database = LoadPlugin<IFriendsData>(dllName, new Object[] { connString, realm }); 80 m_Database = LoadPlugin<IFriendsData>(dllName, new Object[] { connString, realm });
82 if (m_Database == null) 81 if (m_Database == null)
83 throw new Exception("Could not find a storage interface in the given module"); 82 {
83 throw new Exception(
84 string.Format(
85 "Could not find a storage interface {0} in the given StorageProvider {1}", "IFriendsData", dllName));
86 }
84 } 87 }
85 } 88 }
86} 89}