Skip to content

Commit 9152571

Browse files
authored
Merge pull request #382 from sommmen/fix/381_SqlTableCreatorFormatException
fix(logging): Fixed string formats in Selflog.WriteLine calls.
2 parents 1529c4b + 5d7f2c3 commit 9152571

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/ColumnOptions/FinalizeConfigurationForSinkConstructor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ internal void FinalizeConfigurationForSinkConstructor()
6868
// PK must always be NON-NULL
6969
if (PrimaryKey != null && PrimaryKey.AllowNull == true)
7070
{
71-
SelfLog.WriteLine($"Warning: Primary key must be NON-NULL, changing AllowNull property for {PrimaryKey.ColumnName} column.");
71+
SelfLog.WriteLine("Warning: Primary key must be NON-NULL, changing AllowNull property for {0} column.", PrimaryKey.ColumnName);
7272
PrimaryKey.AllowNull = false;
7373
}
7474

@@ -81,7 +81,7 @@ private static void ColumnstoreCompatibilityCheck(SqlColumn column)
8181
throw new ArgumentException($"Columnstore indexes do not support data type \"{column.DataType}\" declared for column \"{column.ColumnName}\".");
8282

8383
if (column.DataLength == -1 && SqlDataTypes.DataLengthRequired.Contains(column.DataType))
84-
SelfLog.WriteLine($"Warning: SQL2017 or newer required to use columnstore index with MAX length column \"{column.ColumnName}\".");
84+
SelfLog.WriteLine("Warning: SQL2017 or newer required to use columnstore index with MAX length column \"{0}\".", column.ColumnName);
8585
}
8686
}
8787
}

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/Platform/SqlLogEventWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void WriteEvent(LogEvent logEvent)
6969
}
7070
catch (Exception ex)
7171
{
72-
SelfLog.WriteLine("Unable to write log event to the database due to following error: {1}", ex.Message);
72+
SelfLog.WriteLine("Unable to write log event to the database due to following error: {0}", ex.Message);
7373
throw;
7474
}
7575
}

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/Platform/SqlTableCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void CreateTable(DataTable dataTable)
4242
}
4343
catch (Exception ex)
4444
{
45-
SelfLog.WriteLine($"Exception creating table {_tableName}:\n{ex}");
45+
SelfLog.WriteLine("Exception creating table {0}:\n{1}", _tableName, ex.ToString());
4646
}
4747
}
4848
}

0 commit comments

Comments
 (0)