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
Problem switching configuration from code to appsettings.json #126
Comments
I'll set up some tests to see what might be happening with the Enricher and SQL level option. (I've used a custom enricher with this config package before, so I know it should work.) I've not used
|
With the configuration file and loading code below, I'm getting this error:
The
|
I found the bug with the |
I merged the PR so when the next dev build is ready for the SQL sink, you should be all set. |
@MV10 And so, I'm set now! 👍 About the public static LoggerConfiguration WithEventType(this LoggerEnrichmentConfiguration enrichmentConfiguration)
{
if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration));
return enrichmentConfiguration.With<EventTypeEnricher>();
} and the correct configuration on JSON file: "Serilog": {
"Using": [ "MyApp.Assembly.Name" ],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId", **"WithEventType"** ],
} Thank you very much! |
Glad to help. |
In my project I'm trying to switch from the Fluent configuration in code to an
appsettings.json
one.Here there is my C# Fluent configuration
And this is my actual
appsettings.json
Now I'm currently dealing with some problems:
My custom Enricher
EventTypeEnricher
, defined inside theMyProject.AssemblyName
that I added toUsing
, is not loaded. I can see because of the Console output template shows a blank space instead of the numeric values.Adding the MSSqlServer block leads to the following Exception:
I'm not sure about configuration of
LevelSwitches
...Is it possible to configure the
Properties.Environment
value dynamically, like it is in my code?The in code configuration is fully functional.
My actual versions of Serilog packages are:
Thanks!
UPDATE
About problem with MSSqlServer configuration, if I remove the
block, I've no more Exceptions, but that leads (obviously) to a runtime Exception:
The text was updated successfully, but these errors were encountered: