A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ravendb/serilog-sinks-ravendb below:

ravendb/serilog-sinks-ravendb: A Serilog sink that writes events to RavenDB

A Serilog sink that writes events as documents to RavenDB.

Package - Serilog.Sinks.RavenDB | Platforms - .NET Standard 2.0 (.NET 4.6.1 or later; .NET Core 2.0 or later)

var logs = new DocumentStore { ConnectionStringName = "Logs" }.Initialize();

var log = new LoggerConfiguration()
    .WriteTo.RavenDB(logs)
    .CreateLogger();

You'll need to create a database on the server for logs, and specify this as your default database in the connection string or DocumentStore.DefaultDatabase. In the alternative, you can pass a default database when configuring the RavenDB sink. More information.

You can also configure the sink through your application config file using Serilog.Settings.AppSettings

Log.Logger = new LoggerConfiguration()
    .ReadFrom.AppSettings()
    .CreateLogger();
<connectionStrings>
  <add name="Logs" connectionString="Url=http://[RAVEN_DB_SERVER]:8080/;DefaultDatabase=[OPTIONAL_DEFAULT_DATABASE]" />
</connectionStrings>
<appSettings>
  <add key="serilog:minimum-level" value="Information" />
  <add key="serilog:using:RavenDB" value="Serilog.Sinks.RavenDB" />
  <add key="serilog:write-to:RavenDB.connectionStringName" value="Logs" />
  <add key="serilog:write-to:RavenDB.defaultDatabase" value="[DEFAULT_DATABASE]" />
</appSettings>
Automatic Log Record Expiration

If you install the RavenDB expiration bundle on the database where log records are stored, you can configure the sink to automatically delete log records. There are two ways to do this:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4