Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/expecho/semanticlogging.database.xml
SemanticLogging.Database.Xml is a sink for the Semantic Logging Application Block that exposes Event Source events to an Sql Server database. The payload data is stored in an xml document instead of a Json document
https://github.com/expecho/semanticlogging.database.xml
etw eventsource logging semantic-logging sql-server sql-server-database sqlserver structured-logging xml
Last synced: about 23 hours ago
JSON representation
SemanticLogging.Database.Xml is a sink for the Semantic Logging Application Block that exposes Event Source events to an Sql Server database. The payload data is stored in an xml document instead of a Json document
- Host: GitHub
- URL: https://github.com/expecho/semanticlogging.database.xml
- Owner: Expecho
- License: mit
- Created: 2015-08-10T08:15:42.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-15T21:26:44.000Z (about 7 years ago)
- Last Synced: 2025-01-07T02:17:44.181Z (11 days ago)
- Topics: etw, eventsource, logging, semantic-logging, sql-server, sql-server-database, sqlserver, structured-logging, xml
- Language: C#
- Homepage:
- Size: 35.2 KB
- Stars: 2
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## XmlSqlDatabaseSink
XmlSqlDatabaseSink is a sink for the [Semantic Logging Application Block](https://msdn.microsoft.com/en-us/library/dn775014(v=pandp.20).aspx) that exposes Event Source events to an Sql Server database.
The default database sink uses a Json document to store the payload data whereas this sink uses an xml document to store the payload data.This sink is also available as a Nuget package: https://www.nuget.org/packages/SemanticLogging.Database.Xml/
## Usage
Usage is the same as with the default database sink. This sink provides one additional parameter to provide the name of the stored procedure
that is used to insert the datarecords. This makes it possible to use multiple XmlSqlDatabaseSink instances that writes to different tables:```c#
var listener1 = new ObservableEventListener();
listener1.LogToSqlDatabase
(
Environment.MachineName,
@"data source=.\sql2012;initial catalog=SinkTests;integrated security=True",
bufferingInterval: TimeSpan.FromSeconds(5),
tableName: "Others",
storedProcedureName: "WriteOthers"
);
listener1.EnableEvents(MyEventSource1.Log, EventLevel.LogAlways);var listener2 = new ObservableEventListener();
listener2.LogToSqlDatabase
(
Environment.MachineName,
@"data source=.\sql2012;initial catalog=SinkTests;integrated security=True",
bufferingInterval: TimeSpan.FromSeconds(5),
tableName: "Sessions",
storedProcedureName: "WriteSessions"
);
listener2.EnableEvents(MyEventSource2.Log, EventLevel.LogAlways);
```
## Query payloadSince the payload is stored in an xml column it is easy to query, for example:
```sql
SELECT
FormattedMessage,
Payload.value('(/Payload/sampleProperty/text())[1]', 'nvarchar(100)') as member,
FROM Traces
```## Out-of-process logging
A sample configuration for out-of-process logging using a windows service (see https://msdn.microsoft.com/en-us/library/dn774996(v=pandp.20).aspx):
```xml
```
## How do I contribute?
Please see [CONTRIBUTE.md](/CONTRIBUTE.md) for more details.