aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Mono/Program.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-13 17:22:25 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-13 17:22:25 -0400
commit3d3876c9a94b86e25b6d663d65285e220fc93bcc (patch)
tree578ce5e8a146bc842d285e3612024d6ee8ed67dd /MediaBrowser.Server.Mono/Program.cs
parent645a41b193a958672a33208b0768cc1d25a4d852 (diff)
better crash logging
Diffstat (limited to 'MediaBrowser.Server.Mono/Program.cs')
-rw-r--r--MediaBrowser.Server.Mono/Program.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs
index 2c2390a81..ea6cca6ff 100644
--- a/MediaBrowser.Server.Mono/Program.cs
+++ b/MediaBrowser.Server.Mono/Program.cs
@@ -206,7 +206,7 @@ namespace MediaBrowser.Server.Mono
{
var exception = (Exception)e.ExceptionObject;
- _logger.ErrorException("UnhandledException", exception);
+ LogUnhandledException(exception);
if (!Debugger.IsAttached)
{
@@ -214,6 +214,19 @@ namespace MediaBrowser.Server.Mono
}
}
+ private static void LogUnhandledException(Exception ex)
+ {
+ _logger.ErrorException("UnhandledException", ex);
+
+ _appHost.LogManager.Flush ();
+
+ var path = Path.Combine(_appHost.ServerConfigurationManager.ApplicationPaths.LogDirectoryPath, "crash_" + Guid.NewGuid() + ".txt");
+
+ var builder = LogHelper.GetLogMessage(ex);
+
+ File.WriteAllText(path, builder.ToString());
+ }
+
/// <summary>
/// Performs the update if needed.
/// </summary>