Home

Awesome

Sejil

Build NuGet

Sejil is a library that enables you to capture, view and filter your ASP.net core app's log events right from your app. It supports structured logging, querying as well as saving log event queries.

Quick Links

Getting started

  1. Installing Sejil package

    dotnet add package Sejil --version 3.0.4
    
  2. Adding code

    Add below code to Program.cs:

    public static IWebHost BuildWebHost(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .UseSejil()  // <-- Add this line
            .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());            
    

    Add below code to Startup.cs

    using Sejil;
    
    public class Startup
    {    
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            // ...
            app.UseSejil();  // <-- Add this line
            // ...
        }
    }
    

    (Optional) To require authentication for viewing logs:

        public void ConfigureServices(IServiceCollection services)
        {
            services.ConfigureSejil(options =>
            {
                options.AuthenticationScheme = /* Your authentication scheme */
            });
        }
    

    (Optional) To change the logs page title (Defaults to Sejil if not set):

        public void ConfigureServices(IServiceCollection services)
        {
            services.ConfigureSejil(options =>
            {
                options.Title = "My title";
            });
        }
    
  3. Navigate to http://your-app-url/sejil to view your app's logs.

Additional logging configuration

Filtering logs

In addition to filtering logs by level; exceptions only; and date range via the UI, you can also search by text to filter your logs:

Features and Screenshots

Building

To build the project, you just need to clone the repo then run the following commands:

git clone https://github.com/alaatm/Sejil.git
cd ./Sejil
dotnet tool restore
dotnet cake

You can run one of the sample apps afterwards:

cd ./sample/SampleBasic
dotnet run

License

License

Copyright © Alaa Masoud.

This project is provided as-is under the Apache 2.0 license. For more information see the LICENSE file.