aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
authorAdam Frisby2008-12-09 03:06:26 +0000
committerAdam Frisby2008-12-09 03:06:26 +0000
commit888151833b1b08a6a8686d75a0385232b7fa90e9 (patch)
tree0507ca2ddf342242561193e027c876e6bcf5bc2d /OpenSim/Region/Application
parentRemove null checks on structs (diff)
downloadopensim-SC-888151833b1b08a6a8686d75a0385232b7fa90e9.zip
opensim-SC-888151833b1b08a6a8686d75a0385232b7fa90e9.tar.gz
opensim-SC-888151833b1b08a6a8686d75a0385232b7fa90e9.tar.bz2
opensim-SC-888151833b1b08a6a8686d75a0385232b7fa90e9.tar.xz
* Added primitive exception logging capabilities.
* Disabled by default (see OpenSim.ini.example for how to enable) * Saves exceptions to a folder on disk (default "crashes") when enabled. * These reports can then be uploaded or posted to help debug an error.
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r--OpenSim/Region/Application/Application.cs29
1 files changed, 20 insertions, 9 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index c891549..08dd7df 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO;
29using System.Net; 30using System.Net;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
@@ -42,6 +43,9 @@ namespace OpenSim
42 43
43 public static string iniFilePath = ""; 44 public static string iniFilePath = "";
44 45
46 public static bool m_saveCrashDumps = false;
47 public static string m_crashDir = "crashes";
48
45 //could move our main function into OpenSimMain and kill this class 49 //could move our main function into OpenSimMain and kill this class
46 public static void Main(string[] args) 50 public static void Main(string[] args)
47 { 51 {
@@ -84,6 +88,9 @@ namespace OpenSim
84 bool background = configSource.Configs["Startup"].GetBoolean("background", false); 88 bool background = configSource.Configs["Startup"].GetBoolean("background", false);
85 bool hgrid = configSource.Configs["Startup"].GetBoolean("hypergrid", false); 89 bool hgrid = configSource.Configs["Startup"].GetBoolean("hypergrid", false);
86 90
91 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false);
92 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
93
87 if (background) 94 if (background)
88 { 95 {
89 OpenSimBase sim = new OpenSimBackground(configSource); 96 OpenSimBase sim = new OpenSimBackground(configSource);
@@ -139,19 +146,23 @@ namespace OpenSim
139 146
140 m_log.ErrorFormat("[APPLICATION]: {0}", msg); 147 m_log.ErrorFormat("[APPLICATION]: {0}", msg);
141 148
142 // Try to post errormessage to an URL 149 // Log exception to disk
143 try 150 try
144 { 151 {
145 // DISABLED UNTIL WE CAN DISCUSS IF THIS IS MORALLY RIGHT OR NOT 152 if (!Directory.Exists(m_crashDir))
146 // Note! Needs reference to System.Web 153 {
147 //System.Net.WebClient wc = new WebClient(); 154 Directory.CreateDirectory(m_crashDir);
148 //wc.DownloadData("http://www.opensimulator.org/ErrorReport.php?Msg=" + 155 }
149 // System.Web.HttpUtility.UrlEncode(msg)); 156 StreamWriter m_crashLog =
150 //wc.Dispose(); 157 new StreamWriter(
158 Path.Combine(m_crashDir, Util.GetUniqueFilename(ex.GetType() + ".txt"))
159 );
160 m_crashLog.WriteLine(msg);
161 m_crashLog.Close();
151 } 162 }
152 catch (WebException) 163 catch (Exception e2)
153 { 164 {
154 // Ignore 165 m_log.ErrorFormat("[CRASH LOGGER CRASHED]: {0}", e2);
155 } 166 }
156 167
157 _IsHandlingException=false; 168 _IsHandlingException=false;