Commit 828dd93
committed
Adding Application.Logs WWI sample
Added a table required to demo LOB support in CLUSTERE COLUMNSOTRE INDEXes.
Scenario is application logging. Applicaiton pushes log events that have large descriptions into the LOB column in CCI table. Table is compliant wiht Serilog logger for .Net and can be direclty used as a target for MSSQL Serilog sink:
In applicaition should be added the following changes to integrate serilog:
1. Download Serilog and Serilog.MSSQL.sink NuGet packages
2. Add the following packages:
using Serilog;
using Serilog.Sinks.MSSqlServer;
3. Configure logger:
var columnOptions = new Serilog.Sinks.MSSqlServer.ColumnOptions();
// Don't include the Properties XML column.
columnOptions.Store.Remove(StandardColumn.Properties);
columnOptions.Store.Remove(StandardColumn.MessageTemplate);
columnOptions.Store.Remove(StandardColumn.Exception);
// Do include the log event data as JSON.
columnOptions.Store.Add(StandardColumn.LogEvent);
var logger = new LoggerConfiguration()
.WriteTo
.MSSqlServer( ConnString, "Logs", schemaName: "Application",
autoCreateSqlTable: false,
columnOptions: columnOptions
)
.CreateLogger());
4. Log events:
var position = new { Latitude = 25, Longitude = 134 };
var elapsedMs = 34;
log.Information("Processed {@position} in {Elapsed:000} ms.", position, elapsedMs);
log.Error(new IndexOutOfRangeException("Test"), "Error while processing {@position} in {Elapsed:000} ms.", position, elapsedMs);1 parent 4a6c5c2 commit 828dd93
2 files changed
Lines changed: 40 additions & 1 deletion
File tree
- samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt
- Application/Tables
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
312 | 313 | | |
313 | 314 | | |
314 | 315 | | |
| |||
0 commit comments