better crash logging

This commit is contained in:
Luke Pulverenti
2013-10-13 17:22:25 -04:00
parent 645a41b193
commit 3d3876c9a9
6 changed files with 66 additions and 13 deletions

View File

@@ -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>