Catch errors when failing to write logs to database

This commit is contained in:
Mark McDowall 2014-03-04 17:02:36 -08:00
parent 571da94629
commit d8f55c0358
1 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using System;
using NLog.Common;
using NLog.Config;
using NLog;
using NLog.Layouts;
@ -79,7 +80,15 @@ namespace NzbDrone.Core.Instrumentation
log.Level = logEvent.Level.Name;
_repository.Insert(log);
try
{
_repository.Insert(log);
}
catch (Exception ex)
{
InternalLogger.Error("Unable to save log event to database: {0}", ex);
throw;
}
}
public void Handle(ApplicationShutdownRequested message)