You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And my appsettings.json does not contain anything. I assume that the Serilog configuration will be as it is defined in code, or does .ReadFrom.Configuration() override the settings in code?
Which log level will "MyAssembly" have now? Verbose or Warning?
Will this change If I place .ReadFrom.Configuration() above .MinimumLevel?
So basically, which order are the settings read in? Can you have i.e. settings for one sink in appsettings and another setting in code and they will both work, or neither, or only one of them?
The text was updated successfully, but these errors were encountered:
Order is important for things like minimum levels/overrides: last-in wins.
For sinks and other objects added to the pipeline, configuration is read separately, so adding a file entry to the JSON configuration, and WriteTo.File() in code, will result in two instances of the file sink being configured.
(IMHO, which is not a popular one, the best way to configure Serilog and just about everything else is to do all configuration in code, only pulling key-value pairs from JSON config for things that actually vary at deployment time. Otherwise, I we're just switching a nwice type-safe, compile-time-validated language for a weaker one. YMMV :-))
Say you have the following configuration set up in code:
And my
appsettings.json
does not contain anything. I assume that the Serilog configuration will be as it is defined in code, or does.ReadFrom.Configuration()
override the settings in code?If I add the following to my
appsettings.json
:Which log level will "MyAssembly" have now? Verbose or Warning?
Will this change If I place
.ReadFrom.Configuration()
above.MinimumLevel
?So basically, which order are the settings read in? Can you have i.e. settings for one sink in appsettings and another setting in code and they will both work, or neither, or only one of them?
The text was updated successfully, but these errors were encountered: