Is there a way to stop DefaultAntiforgery from logging errors? I see it takes an ILoggerFactory as parameter, which is a public type, but I don't know how to set it up since DefaultAntiforgery is internal.
CodePudding user response:
I don't think this is a DI issue, but rather a configuration issue. What you want should be possible by configuring logging
Try something like this in your appsettings.json:
{
"Logging": {
// for all logging providers
"LogLevel": {
"Microsoft.AspNetCore.Antiforgery": "None"
},
// or just for the EventLog provider
"EventLog": {
"LogLevel": {
"Microsoft.AspNetCore.Antiforgery": "None"
}
}
}
}