consolidate exception logging

This commit is contained in:
Luke Pulverenti
2014-11-23 17:36:40 -05:00
parent 70c5b341db
commit 1923de72bf
6 changed files with 48 additions and 38 deletions

View File

@@ -455,9 +455,7 @@ namespace MediaBrowser.ServerApplication
{
var exception = (Exception)e.ExceptionObject;
LogUnhandledException(exception);
_appHost.LogManager.Flush();
new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager).Log(exception);
if (!_isRunningAsService)
{
@@ -470,18 +468,6 @@ namespace MediaBrowser.ServerApplication
}
}
private static void LogUnhandledException(Exception ex)
{
_logger.ErrorException("UnhandledException", ex);
var path = Path.Combine(_appHost.ServerConfigurationManager.ApplicationPaths.LogDirectoryPath, "unhandled_" + Guid.NewGuid() + ".txt");
Directory.CreateDirectory(Path.GetDirectoryName(path));
var builder = LogHelper.GetLogMessage(ex);
File.WriteAllText(path, builder.ToString());
}
/// <summary>
/// Performs the update if needed.
/// </summary>