How many Serilog logger instances should be created for different .net app on same machine?

rutuja k 21 Reputation points
2021-01-18T15:48:04.623+00:00

I am new to Serilog. Trying to understand below scenario. If we have 2 different .net application/controls referring to common serilog config file. The file will contain custom prefix tags corresponding to each application. Each app/custom control has created logger using below in its code:

var app1Logger = new LoggerConfiguration()
.ReadFrom.AppSettings("customprefix1", configFilePath)
.CreateLogger();

var app2Logger = new LoggerConfiguration()
.ReadFrom.AppSettings("customprefix2", configFilePath)
.CreateLogger();
For such scenario, should we be creating different loggers each?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,671 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,248 questions
{count} votes

Accepted answer
  1. Duane Arnold 3,211 Reputation points
    2021-01-18T20:25:15.603+00:00

    If you are talking about two different standalone programs using Serilog, then each program should be using its own logging configuration for Serilog in each program IMHO.

    0 comments No comments

0 additional answers

Sort by: Most helpful