Published on

Centralized logging for .net core ABP microservices app using Seq. Part 8

1 min read
Table of Contents

Intro

In this post we will see how to implement a central logging system for your ABP app using Seq.

Deploy the Seq dockers container

Enable swarm mode

docker swarm init

Create the docker-compose file seq_stack.yaml

version: '3.2'

services:
  seq:
    image: datalust/seq
    ports:
      - 8003:80
      - 5341:5341
    volumes:
      - D:\docker\data\seq:/data
    environment:
      ACCEPT_EULA: 'Y'

To deploy the stack

docker stack deploy -c seq_stack.yaml seq

This will deploy the seq docker container.

Create ABP Tired application

abp new SeqWithAbp -t app -u mvc --tiered

Once the app is created run the DbMigration project to setup the migrations and database seeding.

Install Seq Sink in the projects

Install the Serilog.Sinks.Seq nuget package to the following projects.

  • SeqWithAbp.HttpApi.Host
  • SeqWithAbp.IdentityServer
  • SeqWithAbp.Web

Update the LoggerConfiguration in the Program.cs with the seq endpoint in all the projects.

.WriteTo.Async(c => c.File("Logs/logs.txt"))
.WriteTo.Seq("http://localhost:5341")

This will post all the logs to the seq.

Sample Repo : https://github.com/antosubash/SeqWithAbp