removed method column from log db.

This commit is contained in:
Keivan Beigi 2014-10-15 19:23:10 -07:00
parent cb00644a09
commit d10cdf9c87
5 changed files with 17 additions and 9 deletions

View File

@ -133,7 +133,6 @@ namespace NzbDrone.Core.Test.InstrumentationTests
logItem.Time.Should().BeWithin(TimeSpan.FromSeconds(2));
logItem.Logger.Should().Be(this.GetType().Name);
logItem.Level.Should().Be(level.Name);
logItem.Method.Should().Be(new StackTrace().GetFrame(1).GetMethod().Name);
_logger.Name.Should().EndWith(logItem.Logger);
}
}

View File

@ -0,0 +1,14 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(64)]
public class remove_method_from_logs : NzbDroneMigrationBase
{
protected override void LogDbUpgrade()
{
Delete.Column("Method").FromTable("Logs");
}
}
}

View File

@ -18,8 +18,8 @@ namespace NzbDrone.Core.Instrumentation
{
private readonly SQLiteConnection _connection;
const string INSERT_COMMAND = "INSERT INTO [Logs]([Message],[Time],[Logger],[Method],[Exception],[ExceptionType],[Level]) " +
"VALUES(@Message,@Time,@Logger,@Method,@Exception,@ExceptionType,@Level)";
const string INSERT_COMMAND = "INSERT INTO [Logs]([Message],[Time],[Logger],[Exception],[ExceptionType],[Level]) " +
"VALUES(@Message,@Time,@Logger,@Exception,@ExceptionType,@Level)";
public DatabaseTarget(IConnectionStringFactory connectionStringFactory)
{
@ -28,8 +28,6 @@ namespace NzbDrone.Core.Instrumentation
public void Register()
{
Layout = new SimpleLayout("${callsite:className=false:fileName=false:includeSourcePath=false:methodName=true}");
Rule = new LoggingRule("*", LogLevel.Info, this);
LogManager.Configuration.AddTarget("DbLogger", this);
@ -61,7 +59,6 @@ namespace NzbDrone.Core.Instrumentation
var log = new Log();
log.Time = logEvent.TimeStamp;
log.Message = CleanseLogMessage.Cleanse(logEvent.FormattedMessage);
log.Method = Layout.Render(logEvent);
log.Logger = logEvent.LoggerName;
@ -94,7 +91,6 @@ namespace NzbDrone.Core.Instrumentation
sqlCommand.Parameters.Add(new SQLiteParameter("Message", DbType.String) { Value = log.Message });
sqlCommand.Parameters.Add(new SQLiteParameter("Time", DbType.DateTime) { Value = log.Time });
sqlCommand.Parameters.Add(new SQLiteParameter("Logger", DbType.String) { Value = log.Logger });
sqlCommand.Parameters.Add(new SQLiteParameter("Method", DbType.String) { Value = log.Method });
sqlCommand.Parameters.Add(new SQLiteParameter("Exception", DbType.String) { Value = log.Exception });
sqlCommand.Parameters.Add(new SQLiteParameter("ExceptionType", DbType.String) { Value = log.ExceptionType });
sqlCommand.Parameters.Add(new SQLiteParameter("Level", DbType.String) { Value = log.Level });

View File

@ -13,8 +13,6 @@ namespace NzbDrone.Core.Instrumentation
public string Logger { get; set; }
public string Method { get; set; }
public string Exception { get; set; }
public string ExceptionType { get; set; }

View File

@ -225,6 +225,7 @@
<Compile Include="Datastore\Migration\058_drop_epsiode_file_path.cs" />
<Compile Include="Datastore\Migration\059_add_enable_options_to_indexers.cs" />
<Compile Include="Datastore\Migration\063_add_remotepathmappings.cs" />
<Compile Include="Datastore\Migration\064_add_remove_method_from_logs.cs" />
<Compile Include="Datastore\Migration\061_clear_bad_scene_names.cs" />
<Compile Include="Datastore\Migration\060_remove_enable_from_indexers.cs" />
<Compile Include="Datastore\Migration\062_convert_quality_models.cs" />