serilog-settings-configuration
serilog-settings-configuration copied to clipboard
How to configure with multiple instances of same app/executable?
hi,
I have an app that runs multiple instances of .Net windows Service (like Instance1, Instance2 etc) using same exe, but with different arguments. Now I am trying to add Serilog configuration to this app and planning to use File sink. In such case, how can I make sure that each instance is using its own file as the appsettings file will be common?
Thanks!
You can pass different names via environment variables https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-7.0#non-prefixed-environment-variables or command line https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-7.0#command-line to override "fixed" setting from json configuration file.