-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add customized JSON Formmter in appsettings.json #28
Comments
You need to put in a full type name (the equivalent of It must contain the type name and the full namespace before it. For example : Here is an example in the test suite : |
Yes. I have tried in that way too, I add the full namespace and everything. But it cause the same error. |
Ooops, my bad, I gave you a link to the core Serilog repo ... The behavior seems to be slightly different in in Serilog.Settings.Configuration, the one used for From this test, I see you need to provide the full *Assembly qualified name, which should be something like this :
From MSDN :
I'm not sure Version, Culture and PublicKeyToken are really required though. |
With the full Assembly qualified name, it works great now. |
I'll close the issue :) |
I created a customized JSON Formatter which extends ITextFormatter
And try to add it to appsetting.json like this:
"WriteTo": [
{
"Name": "Console",
"Args": {
"formatter": "CustomizedJSONFormatter"
// "formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
}
},
The default jsonFormatter works fine as shown in the commented line.
But I will get an error if I want to add the customized one:
InvalidCastException: Invalid cast from 'System.String' to 'Serilog.Formatting.ITextFormatter'.
Is there anyway to solve this?
Thanks!
The text was updated successfully, but these errors were encountered: