-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Support logging on DB level #2557
Comments
There is a new API for logging now: https://erikej.github.io/efcore/2020/05/18/ef-core-simple-logging.html |
The API linked to above has been introduced for 5.0, which hasn't yet been released. Until that happens, you can still configure logging in EF Core as detailed in this page. |
Ok, but this change logger for all entire |
@Saibamen You could setup a switch on the context to allow logging to be switched on when needed. For example: public class SomeDbContext : DbContext
{
public bool LoggingEnabled { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.LogTo(s =>
{
if (LoggingEnabled)
{
Console.WriteLine(s);
}
})
.EnableSensitiveDataLogging()
.UseSqlServer(Your.SqlServerConnectionString);
} |
Could be a useful addition to the docs. |
Thanks |
**No TOC yet since we need to decide what to do with `Fundamentals`. @smitpatel I do not intend to merge this way.** * Fixes #2615: Add information on controlling suppressing warnings and otherwise configuring EventIds * Fixes #2557: Support logging on DB level #2557 * Fixes #2770: Add entry in TOC for logging/interceptors * Fixes #583: Document how to use DiagnosticSource/DiagnosticListener * Fixes #673: Document EnableSensitiveDataLogging * Fixes #1913: Interception of database operations: InterceptionResult or InterceptionResult<DbDataReader>? * Fixes #1543: Document database interceptors with examples * Fixes #955: Document EnableRichDataErrorHandling * Fixes #661: EF Core 2.1: document state change events
**No TOC yet since we need to decide what to do with `Fundamentals`. @smitpatel I do not intend to merge this way.** * Fixes #2615: Add information on controlling suppressing warnings and otherwise configuring EventIds * Fixes #2557: Support logging on DB level #2557 * Fixes #2770: Add entry in TOC for logging/interceptors * Fixes #583: Document how to use DiagnosticSource/DiagnosticListener * Fixes #673: Document EnableSensitiveDataLogging * Fixes #1913: Interception of database operations: InterceptionResult or InterceptionResult<DbDataReader>? * Fixes #1543: Document database interceptors with examples * Fixes #955: Document EnableRichDataErrorHandling * Fixes #661: EF Core 2.1: document state change events
**No TOC yet since we need to decide what to do with `Fundamentals`. @smitpatel I do not intend to merge this way.** * Fixes #2615: Add information on controlling suppressing warnings and otherwise configuring EventIds * Fixes #2557: Support logging on DB level #2557 * Fixes #2770: Add entry in TOC for logging/interceptors * Fixes #583: Document how to use DiagnosticSource/DiagnosticListener * Fixes #673: Document EnableSensitiveDataLogging * Fixes #1913: Interception of database operations: InterceptionResult or InterceptionResult<DbDataReader>? * Fixes #1543: Document database interceptors with examples * Fixes #955: Document EnableRichDataErrorHandling * Fixes #661: EF Core 2.1: document state change events
**No TOC yet since we need to decide what to do with `Fundamentals`. @smitpatel I do not intend to merge this way.** * Fixes #2615: Add information on controlling suppressing warnings and otherwise configuring EventIds * Fixes #2557: Support logging on DB level #2557 * Fixes #2770: Add entry in TOC for logging/interceptors * Fixes #583: Document how to use DiagnosticSource/DiagnosticListener * Fixes #673: Document EnableSensitiveDataLogging * Fixes #1913: Interception of database operations: InterceptionResult or InterceptionResult<DbDataReader>? * Fixes #1543: Document database interceptors with examples * Fixes #955: Document EnableRichDataErrorHandling * Fixes #661: EF Core 2.1: document state change events
**No TOC yet since we need to decide what to do with `Fundamentals`. @smitpatel I do not intend to merge this way.** * Fixes #2615: Add information on controlling suppressing warnings and otherwise configuring EventIds * Fixes #2557: Support logging on DB level #2557 * Fixes #2770: Add entry in TOC for logging/interceptors * Fixes #583: Document how to use DiagnosticSource/DiagnosticListener * Fixes #673: Document EnableSensitiveDataLogging * Fixes #1913: Interception of database operations: InterceptionResult or InterceptionResult<DbDataReader>? * Fixes #1543: Document database interceptors with examples * Fixes #955: Document EnableRichDataErrorHandling * Fixes #661: EF Core 2.1: document state change events
* Fixes #2615: Add information on controlling suppressing warnings and otherwise configuring EventIds * Fixes #2557: Support logging on DB level #2557 * Fixes #2770: Add entry in TOC for logging/interceptors * Fixes #583: Document how to use DiagnosticSource/DiagnosticListener * Fixes #673: Document EnableSensitiveDataLogging * Fixes #1913: Interception of database operations: InterceptionResult or InterceptionResult<DbDataReader>? * Fixes #1543: Document database interceptors with examples * Fixes #955: Document EnableRichDataErrorHandling * Fixes #661: EF Core 2.1: document state change events
I'm migration from EF to EF Core 5.0 (preview 6 now), but there is no
Log
inDbContext.Database
anymore.The text was updated successfully, but these errors were encountered: