what's the equivalent to the "EnableSensitiveDataLogging" in EF 6.2?

664 Views Asked by At

I want to enable EnableSensitiveDataLogging(which is available in Entity Framework Core), but it seems like there is not such a thing in in Entity Framework. is there an alternative to it in Entity Framework? (I'm using EF 6.2, and the reason that I want to enable it is to see the posted data in Serilog's log's file).

 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
   {
      optionsBuilder.EnableSensitiveDataLogging();
    // ...
   }

EDIT--> I want to log the data model which is posted via my web api using serilog. I'm using Serilog.sinks.File and Swrilog.Sinks.SQLSERVER.

my StartUp.cs class:

    Log.Logger = new LoggerConfiguration()
            .ReadFrom.AppSettings()               
            .WriteTo.MSSqlServer(ConnectionString, 
    "Serilogs").Enrich.WithUserName()
            .Enrich.With<UserNameEnricher> 
   ().Enrich.With<WebApiControllerNameEnricher>()
            .Enrich.WithWebApiRouteData().Enrich
            .WithWebApiControllerName()
            .Enrich.WithWebApiActionName()
            .Enrich.WithWebApiRouteTemplate()               
            .CreateLogger();
        SerilogWebClassic.Configure(cfg => cfg
            .UseLogger(Log.Logger)
            .LogAtLevel(LogEventLevel.Error)
            .EnableFormDataLogging(forms => forms
                .AtLevel(LogEventLevel.Information)
                .OnlyOnError()
                .FilterKeywords(new[] { "password", "authToken" })
            ));
0

There are 0 best solutions below