Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete exception handlers #602

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# 8.1.0
* Implemented #542: Column option `ResolveHierarchicalPropertyName` to force non-hierarchical handling

# 8.0.1
* Removed unnecessary exception handlers and let Serilog Core do the SelfLog()
* Refactoring and performance optimizations in batched and audit sink
* Create perftest result on release
* Updated issue template
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ public async Task WriteBatch(IEnumerable<LogEvent> events)
}
}
}
catch (Exception ex)
{
SelfLog.WriteLine("Unable to write batch of {0} log events to the database due to following error: {1}",
events.Count(), ex);
throw;
}
finally
{
_dataTable.Clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,34 +43,26 @@ public SqlInsertStatementWriter(

public async Task WriteEvents(IEnumerable<LogEvent> events)
{
try
using (var cn = _sqlConnectionFactory.Create())
{
using (var cn = _sqlConnectionFactory.Create())
await cn.OpenAsync().ConfigureAwait(false);

foreach (var logEvent in events)
{
await cn.OpenAsync().ConfigureAwait(false);
var fields = _logEventDataGenerator.GetColumnsAndValues(logEvent).ToList();
InitializeSqlCommand(cn, fields);

foreach (var logEvent in events)
var index = 0;
_sqlCommand.ClearParameters();
foreach (var field in fields)
{
var fields = _logEventDataGenerator.GetColumnsAndValues(logEvent).ToList();
InitializeSqlCommand(cn, fields);

var index = 0;
_sqlCommand.ClearParameters();
foreach (var field in fields)
{
_sqlCommand.AddParameter(Invariant($"@P{index}"), field.Value);
index++;
}

await _sqlCommand.ExecuteNonQueryAsync().ConfigureAwait(false);
_sqlCommand.AddParameter(Invariant($"@P{index}"), field.Value);
index++;
}

await _sqlCommand.ExecuteNonQueryAsync().ConfigureAwait(false);
}
}
catch (Exception ex)
{
SelfLog.WriteLine("Unable to write log event to the database due to following error: {0}", ex);
throw;
}
}

/// <summary>
Expand Down
Loading