Giter Club home page Giter Club logo

serilog-sinks-ravendb's Introduction

Serilog.Sinks.RavenDB

Build status

A Serilog sink that writes events as documents to RavenDB.

Package - Serilog.Sinks.RavenDB | Platforms - .NET 4.5

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 by passing errorExpiration (for fatal and error messages) and expiration (for all other messages). If you pass one, you should pass both. Timeout.InfiniteTimeSpan indicates that messages of the appropriate type will never be deleted by the expiration bundle.

serilog-sinks-ravendb's People

Contributors

nblumhardt avatar tcabanski avatar ayende avatar manu-vilachan avatar

Watchers

Fernando Minoru Baba avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.