-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overriding Default Settings #26
Comments
Interesting ticket, thanks for the example. I'm not sure there will be a simpler solution than just doing everything programmatically - the range of possible configurations is pretty vast. One thing you might explore is doing the overriding via the configuration subsystem itself; e.g. create an in-memory configuration source with the defaults, and add it to the |
I was hoping that Your idea for in-memory config is a reasonable workaround. Perhaps
|
Could not reproduce this. That's strange.. As far as I know .WriteTo.RollingFile(...)
.MinimumLevel.ControlledBy(new LoggingLevelSwitch(LogEventLevel.Debug))
.MinimumLevel.Override("Microsoft", new LoggingLevelSwitch(LogEventLevel.Warning))
.MinimumLevel.Override("System", new LoggingLevelSwitch(LogEventLevel.Warning))
.Enrich.WithProperty("Country", "UK")
.Enrich.WithProperty("Environment", "Development")
.CreateLogger(); |
@RehanSaeed would issue serilog/serilog#1038 help ? feedback would be welcome :) |
I recently found myself needing something similar to this in regards to sharing configuration via a separate library. After following the various links here and in other issues I found the serilog-settings-combined repository, but it looks like development stopped quite some time ago. As @nblumhardt suggested, I also tried creating a custom configuration provider, but ran into an issue where arguments for the Oracle sink were not being passed correctly for sink initialization. I was unable to determine why from appsettings.json everything worked fine, but the same values via my custom provider did not. Anyway, just wanted to see if anyone else had any ideas for sharing configuration across multiple solutions. Edit |
Closing this in favor of serilog-settings-combined as discussion about mixing with |
I would like to provide some sensible defaults before relying on configuration to override settings e.g.
Environment.UserInteractive
to turn on console logging.AssemblyProductAttribute
to provide a Source property.How can I provide these defaults and use configuration to override them, rather than replace them entirely?
The text was updated successfully, but these errors were encountered: