You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Option added to exclude redundant properties from serialized JSON in column LogEvent. (https://github.com/serilog/serilog-sinks-mssqlserver/pull/27)
69
+
* Option added to exclude redundant properties from serialized JSON in column LogEvent. (https://github.com/serilog-mssql/serilog-sinks-mssqlserver/pull/27)
70
70
71
71
# 2.0.32
72
-
* Safe conversion of data types. Also included selflog for bulk operation errors. (https://github.com/serilog/serilog-sinks-mssqlserver/pull/4)
72
+
* Safe conversion of data types. Also included selflog for bulk operation errors. (https://github.com/serilog-mssql/serilog-sinks-mssqlserver/pull/4)
73
73
74
74
# 2.0.31
75
-
* Added the ability to configure additional columns via XML configuration (https://github.com/serilog/serilog-sinks-mssqlserver/pull/6)
75
+
* Added the ability to configure additional columns via XML configuration (https://github.com/serilog-mssql/serilog-sinks-mssqlserver/pull/6)
76
76
77
77
# 2.0.30
78
-
* You can optionally save the log event inside the database too. Also added ability to exclude the properties if they are saved already inside additional columns. (https://github.com/serilog/serilog-sinks-mssqlserver/pull/7)
78
+
* You can optionally save the log event inside the database too. Also added ability to exclude the properties if they are saved already inside additional columns. (https://github.com/serilog-mssql/serilog-sinks-mssqlserver/pull/7)
A Serilog sink that writes events to Microsoft SQL Server. This sink will write the log event data to a table and can optionally also store the properties inside an XML or JSON column so they can be queried. Important properties can also be written to their own separate columns.
4
4
@@ -147,7 +147,7 @@ var log = new LoggerConfiguration()
147
147
148
148
### Code + _System.Configuration_
149
149
150
-
Projects can load `MSSqlServerSinkOptions` and `ColumnOptions` objects from an XML configuration file such as `app.config` or `web.config`. The sink configuration method automatically checks `ConfigurationManager`, so there is no code to show, and no additional packages are required. See the [External Configuration Syntax](#external-configuration-syntax) topic for details.
150
+
Projects can load `MSSqlServerSinkOptions` and `ColumnOptions` objects from an XML configuration file such as `app.config` or `web.config`. The sink configuration method automatically checks `ConfigurationManager`, so there is no code to show, and no additional packages are required. See the [External Configuration Syntax](#external-configuration-syntax) topic for details.
151
151
152
152
### External using _Serilog.Settings.Configuration_
@@ -263,17 +263,17 @@ A flag specifiying if the log events table should be created if it does not exis
263
263
264
264
### BatchPostingLimit
265
265
266
-
Specifies a maximum number of log events that the non-audit sink writes per batch. The default is 50.
266
+
Specifies a maximum number of log events that the non-audit sink writes per batch. The default is 50.
267
267
This setting is not used by the audit sink as it writes each event immediately and not in a batched manner.
268
268
269
269
### BatchPeriod
270
270
271
-
Specifies the interval in which the non-audit sink writes a batch of log events to the database. It defaults to 5 seconds.
271
+
Specifies the interval in which the non-audit sink writes a batch of log events to the database. It defaults to 5 seconds.
272
272
This setting is not used by the audit sink as it writes each event immediately and not in a batched manner.
273
273
274
274
### EagerlyEmitFirstEvent
275
275
276
-
A Flag to eagerly write a batch to the database containing the first received event regardless of `BatchPostingLimit` or `BatchPeriod`. It defaults to `true`.
276
+
A Flag to eagerly write a batch to the database containing the first received event regardless of `BatchPostingLimit` or `BatchPeriod`. It defaults to `true`.
277
277
This setting is not used by the audit sink as it writes each event immediately and not in a batched manner.
278
278
279
279
### UseAzureManagedIdentity
@@ -537,21 +537,21 @@ In this example, when a log event contains any of the properties `UserName`, `Us
537
537
538
538
Unlike previous versions of the sink, Standard Column names are not reserved. If you remove the `Id` Standard Column from the `ColumnOptions.Store` list, you are free to create a new custom column called `Id` which the sink will treat like any other custom column fully under your control.
539
539
540
-
Note the use of the `SqlDbType` enumerations for specifying `DataType`. Unlike previous versions of the sink, .NET `System` data types and `DataColumn` objects are no longer used for custom column definition.
540
+
Note the use of the `SqlDbType` enumerations for specifying `DataType`. Unlike previous versions of the sink, .NET `System` data types and `DataColumn` objects are no longer used for custom column definition.
541
541
542
542
### Excluding redundant data
543
543
544
-
By default, properties matching a custom column will still be included in the data saved to the XML `Properties` or JSON `LogEvent` column. This is consistent with the idea behind structured logging, and makes it easier to convert the log data to another document-data storage platform later, if desired.
544
+
By default, properties matching a custom column will still be included in the data saved to the XML `Properties` or JSON `LogEvent` column. This is consistent with the idea behind structured logging, and makes it easier to convert the log data to another document-data storage platform later, if desired.
545
545
546
-
However, the properties being saved in their own columns can be excluded from these catch-all columns. Use the `columnOptions.Properties.ExcludeAdditionalProperties` parameter to exclude the redundant properties from the `Properties` XML column, or `columnOptions.LogEvent.ExcludeAdditionalProperties` if you're using the JSON `LogEvent` column.
546
+
However, the properties being saved in their own columns can be excluded from these catch-all columns. Use the `columnOptions.Properties.ExcludeAdditionalProperties` parameter to exclude the redundant properties from the `Properties` XML column, or `columnOptions.LogEvent.ExcludeAdditionalProperties` if you're using the JSON `LogEvent` column.
547
547
548
548
Standard Columns are always excluded from the XML `Properties` column but Standard Columns are included in the JSON data for backwards-compatibility reasons. They can be excluded from the JSON `LogEvent` column with `columnOptions.LogEvent.ExcludeStandardColumns`.
549
549
550
550
## External Configuration Syntax
551
551
552
552
Projects targeting frameworks which are compatible with _System.Configuration_ automatically have support for XML-based configuration (either `app.config` or `web.config`) of a `MSSqlServerSinkOptions` parameters and a `ColumnOptions` table definition, and the _Serilog.Settings.AppSettings_ package adds XML-based configuration of other direct sink arguments (like `customFormatter` or `restrictedToMinimumLevel`).
553
553
554
-
Projects targeting frameworks which are compatible with _Microsoft.Extensions.Configuration_ can apply configuration-driven sink setup and `MSSqlServerSinkOptions` or `ColumnOptions` settings using the _Serilog.Settings.Configuration_ package or by supplying the appropriate arguments through code.
554
+
Projects targeting frameworks which are compatible with _Microsoft.Extensions.Configuration_ can apply configuration-driven sink setup and `MSSqlServerSinkOptions` or `ColumnOptions` settings using the _Serilog.Settings.Configuration_ package or by supplying the appropriate arguments through code.
555
555
556
556
All properties of the `MSSqlServerSinkOptions` class are configurable and almost all of the `ColumnOptions` class except the `Properties.PropertyFilter` predicate expression, and all elements and lists shown are optional. In most cases configuration key names match the class property names, but there are some exceptions. For example, because `PrimaryKey` is a `SqlColumn` object reference when configured through code, external configuration uses a `primaryKeyColumnName` setting to identify the primary key by name.
557
557
@@ -571,8 +571,8 @@ Keys and values are not case-sensitive. This is an example of configuring the si
571
571
"Using": ["Serilog.Sinks.MSSqlServer"],
572
572
"MinimumLevel": "Debug",
573
573
"WriteTo": [
574
-
{ "Name": "MSSqlServer",
575
-
"Args": {
574
+
{ "Name": "MSSqlServer",
575
+
"Args": {
576
576
"connectionString": "NamedConnectionString",
577
577
"sinkOptionsSection": {
578
578
"tableName": "Logs",
@@ -583,7 +583,7 @@ Keys and values are not case-sensitive. This is an example of configuring the si
583
583
},
584
584
"restrictedToMinimumLevel": "Warning",
585
585
"columnOptionsSection": { . . . }
586
-
}
586
+
}
587
587
}
588
588
]
589
589
}
@@ -612,15 +612,15 @@ As the name suggests, `columnOptionSection` is an entire configuration section i
@@ -667,9 +667,9 @@ Keys and values are case-sensitive. Case must match **_exactly_** as shown below
667
667
</RemoveStandardColumns>
668
668
<Columns>
669
669
<addColumnName="EventType"DataType="int"/>
670
-
<addColumnName="EnvironmentUserName"
671
-
PropertyName="UserName"
672
-
DataType="varchar"
670
+
<addColumnName="EnvironmentUserName"
671
+
PropertyName="UserName"
672
+
DataType="varchar"
673
673
DataLength="50" />
674
674
<addColumnName="Release"
675
675
DataType="varchar"
@@ -698,7 +698,7 @@ Keys and values are case-sensitive. Case must match **_exactly_** as shown below
698
698
StructureElementName="struct"
699
699
UsePropertyKeyAsElementName="false"/>
700
700
<TimeStampConvertToUtc="true"/>
701
-
</MSSqlServerSettingsSection>
701
+
</MSSqlServerSettingsSection>
702
702
```
703
703
704
704
### XML Sink (_Serilog.Settings.AppSettings_)
@@ -738,15 +738,15 @@ When you exit an application running in debug mode under Visual Studio, normal s
738
738
739
739
### Try a `dev` package
740
740
741
-
If you're reading about a feature that doesn't seem to work, check whether you're reading the docs for the `master` branch or the `dev` branch -- most Serilog repositories are configured to use the `dev` branch by default. If you see something interesting only described by the `dev` branch documentation, you'll have to reference a `dev`-versioned package. The repository automatically generates a new `dev` package whenever code-related changes are merged.
741
+
If you're reading about a feature that doesn't seem to work, check whether you're reading the docs for the `main` branch or the `dev` branch -- most Serilog repositories are configured to use the `dev` branch by default. If you see something interesting only described by the `dev` branch documentation, you'll have to reference a `dev`-versioned package. The repository automatically generates a new `dev` package whenever code-related changes are merged.
742
742
743
743
### Are you really using this sink?
744
744
745
745
Please check your NuGet references and confirm you are specifically referencing _Serilog.Sinks.MSSqlServer_. In the early days of .NET Core, there was a popular Core-specific fork of this sink, but the documentation and NuGet project URLs pointed here. Today the package is marked deprecated, but we continue to see some confusion around this.
746
746
747
747
### .NET Framework apps must reference Microsoft.Data.SqlClient
748
748
749
-
If you are using the sink in a .NET Framework app, make sure to add a nuget package reference to Microsoft.Data.SqlClient in your app project. This is necessary due to a bug in SqlClient which can lead to exceptions about missing Microsoft assemblies. Details can be found in [issue 283](https://github.com/serilog/serilog-sinks-mssqlserver/issues/283#issuecomment-664397489) and [issue 208](https://github.com/serilog/serilog-sinks-mssqlserver/issues/208#issuecomment-664503566).
749
+
If you are using the sink in a .NET Framework app, make sure to add a nuget package reference to Microsoft.Data.SqlClient in your app project. This is necessary due to a bug in SqlClient which can lead to exceptions about missing Microsoft assemblies. Details can be found in [issue 283](https://github.com/serilog-mssql/serilog-sinks-mssqlserver/issues/283#issuecomment-664397489) and [issue 208](https://github.com/serilog-mssql/serilog-sinks-mssqlserver/issues/208#issuecomment-664503566).
750
750
751
751
## Querying Property Data
752
752
@@ -804,6 +804,6 @@ Feature | Notes
804
804
:--- | :---
805
805
`AdditionalDataColumns` | Use the `AdditionalColumns` collection instead. Configuring the sink no longer relies upon .NET `DataColumn` objects or .NET `System` types.
806
806
`Id.BigInt` | Use `Id.DataType = SqlDb.BigInt` instead. (The `BigInt` property was only available in dev packages).
807
-
`Binary` and `VarBinary` | Due to the way Serilog represents property data internally, it isn't possible for the sink to access property data as a byte array, so the sink can't write to these column types.
807
+
`Binary` and `VarBinary` | Due to the way Serilog represents property data internally, it isn't possible for the sink to access property data as a byte array, so the sink can't write to these column types.
808
808
809
809
Most deprecated features are still available, but they are marked with the `[Obsolete]` attribute (which results in a compiler warning in your project) and will be removed in a future release. You should switch to the replacement implementations as soon as possible. Where possible, internally these are converted to the replacement implementation so that they only exist at the configuration level.
0 commit comments