removed method column from log db.

pull/124/head
Keivan Beigi 10 years ago
parent cb00644a09
commit d10cdf9c87

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

@ -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");
}
}
}

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

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

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

Loading…
Cancel
Save