Skip to content

Commit d51a49e

Browse files
committed
Don't add properties which were logged to in additional columns.
Don't add properties which were logged to in additional columns.
1 parent 0226105 commit d51a49e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/MSSqlServerSinkTraits.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ internal class MSSqlServerSinkTraits : IDisposable
3737
public ColumnOptions ColumnOptions { get; }
3838
public IFormatProvider FormatProvider { get; }
3939
public ITextFormatter LogEventFormatter { get; }
40-
public ISet<string> AdditionalColumnNames { get; }
40+
public ISet<string> AdditionalColumnPropertyNames { get; }
4141
public DataTable EventTable { get; }
4242
public ISet<string> StandardColumnNames { get; }
4343

@@ -82,10 +82,10 @@ internal MSSqlServerSinkTraits(
8282
StandardColumnNames.Add(col.ColumnName);
8383
}
8484

85-
AdditionalColumnNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
85+
AdditionalColumnPropertyNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
8686
if (ColumnOptions.AdditionalColumns != null)
8787
foreach (var col in ColumnOptions.AdditionalColumns)
88-
AdditionalColumnNames.Add(col.ColumnName);
88+
AdditionalColumnPropertyNames.Add(col.PropertyName);
8989

9090
if (ColumnOptions.Store.Contains(StandardColumn.LogEvent))
9191
LogEventFormatter = logEventFormatter ?? new JsonLogEventFormatter(this);
@@ -163,7 +163,7 @@ private string RenderLogEventColumn(LogEvent logEvent)
163163
{
164164
if (ColumnOptions.LogEvent.ExcludeAdditionalProperties)
165165
{
166-
var filteredProperties = logEvent.Properties.Where(p => !AdditionalColumnNames.Contains(p.Key));
166+
var filteredProperties = logEvent.Properties.Where(p => !AdditionalColumnPropertyNames.Contains(p.Key));
167167
logEvent = new LogEvent(logEvent.Timestamp, logEvent.Level, logEvent.Exception, logEvent.MessageTemplate, filteredProperties.Select(x => new LogEventProperty(x.Key, x.Value)));
168168
}
169169

@@ -178,7 +178,7 @@ private string ConvertPropertiesToXmlStructure(IEnumerable<KeyValuePair<string,
178178
var options = ColumnOptions.Properties;
179179

180180
if (options.ExcludeAdditionalProperties)
181-
properties = properties.Where(p => !AdditionalColumnNames.Contains(p.Key));
181+
properties = properties.Where(p => !AdditionalColumnPropertyNames.Contains(p.Key));
182182

183183
if (options.PropertiesFilter != null)
184184
{

0 commit comments

Comments
 (0)