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
Copy file name to clipboardExpand all lines: README.md
+47-10Lines changed: 47 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -410,13 +410,21 @@ Standard Columns are always excluded from the XML `Properties` column but Stand
410
410
411
411
## External Configuration Syntax
412
412
413
-
The _Serilog.Settings.AppSettings_ package supports XML-based configuration (either `app.config` or `web.config`), and the _Serilog.Settings.Configuration_ package supports the many _Microsoft.Extensions.Configuration_ sources. JSON is the most common, but other sources include environment variables, command lines, Azure Key Vault, XML, and more.
413
+
Projects targeting the .NET Framework automatically have support for XML-based configuration (either `app.config` or `web.config`) of `ColumnOptions` settings, and the _Serilog.Settings.AppSettings_ package adds XML-based configuration of sink arguments.
414
414
415
-
### JSON syntax
415
+
Projects targeting .NET Standard can apply configuration-driven sink setup and `ColumnOptions` settings using the _Serilog.Settings.Configuration_ (SSC) package. It supports any of the configuration sources supported by the underlying _Microsoft.Extensions.Configuration_ (MEC) packages. JSON is the most common, but other sources include environment variables, command lines, Azure Key Vault, XML, and more.
416
416
417
417
All properties of the `ColumnOptions` class are configurable except the `Properties.PropertyFilter` predicate expression. In most cases configuration keynames 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.
418
418
419
-
Keys and values are not case-sensitive.
419
+
All `ColumnOptions` elements and lists are optional. Some settings or properties shown are mutually exclusive and are listed for documentation purposes -- these do not necessarily reflect real-world configurations that can be copy-pasted as-is.
420
+
421
+
Custom columns and the stand-alone Standard Column entires all support the same general column properties (`ColumnName`, `DataType`, etc) listed in thec [SqlColumn Objects](#sqlcolumn-objects) topic. The samples omit many of these properties for brevity.
422
+
423
+
If you combine external configuration with configuration through code, external configuration changes will be applied in addition to any `ColumnOptions` object you provide through code.
424
+
425
+
### JSON: .NET Standard configuration
426
+
427
+
Keys and values are not case-sensitive. This is an example of configuring the sink arguments.
420
428
421
429
```json
422
430
{
@@ -441,15 +449,15 @@ Keys and values are not case-sensitive.
441
449
}
442
450
```
443
451
444
-
As the name suggests, `columnOptionSection` is an entire configuration section in its own right. All possible entries are shown below, excluding properties like `ColumnName` and `AllowNull` that are available on every column definition. Some sample values are also shown below. All properties and subsections are optional. The `AdditionalColumns` collection can also be populated from a key named `customColumns`for backwards-compatibility reasons (not shown here). Some properties shown here are mutually exclusive (such as `clusteredColumnstoreIndex` and `primaryKeyColumnName`) -- the following does not represent a real-world configuration example, it is only a reference.
452
+
As the name suggests, `columnOptionSection` is an entire configuration section in its own right. The `AdditionalColumns` collection can also be populated from a key named `customColumns` (not shown here) for backwards-compatibility reasons.
When targeting the .NET Framework, built-in support for `ConfigurationManager` allows you to define custom columns as it is represented in SQL Server. Columns specified must match the physical database exactly. This section will be processed automatically if it exists in the application's `web.config` or `app.config` file. The same properties listed in the topic [SqlColumn Objects](#sqlcolumn-objects) are available here.
501
+
Keys and values are case-sensitive. Case must match **_exactly_** as shown below.
@@ -506,10 +522,31 @@ When targeting the .NET Framework, built-in support for `ConfigurationManager` a
506
522
AllowNull="true"
507
523
NonClusteredIndex="false"/>
508
524
</Columns>
525
+
<ExceptionColumnName="Ex"DataLength="512"/>
526
+
<IdNonClusteredIndex="true"/>
527
+
<LevelColumnName="Severity"StoreAsEnum="true"/>
528
+
<LogEventExcludeAdditionalProperties="true"
529
+
ExcludeStandardColumns="true"/>
530
+
<MessageDataLength="1024"/>
531
+
<MessageTemplateDataLength="1536"/>
532
+
<PropertiesDataType="xml"
533
+
ExcludeAdditionalProperties="true"
534
+
DictionaryElementName="dict"
535
+
ItemElementName="item"
536
+
OmitDictionaryContainerElement="false"
537
+
OmitSequenceContainerElement="false"
538
+
OmitStructureContainerElement="false"
539
+
OmitElementIfEmpty="true"
540
+
PropertyElementName="prop"
541
+
RootElementName="root"
542
+
SequenceElementName="seq"
543
+
StructureElementName="struct"
544
+
UsePropertyKeyAsElementName="false"/>
545
+
<TimeStampConvertToUtc="true"/>
509
546
</MSSqlServerSettingsSection>
510
547
```
511
548
512
-
### AppSettings XML syntax
549
+
### XML: AppSettings sink configuration
513
550
514
551
Refer to the _Serilog.Settings.AppSetings_ package documentation for complete details about sink configuration. This is an example of seting some of the configuration parameters for this sink.
Copy file name to clipboardExpand all lines: src/Serilog.Sinks.MSSqlServer/Configuration/Microsoft.Extensions.Configuration/LoggerConfigurationMSSqlServerExtensions.cs
0 commit comments