How can I turn off Entity Framework 6.1 logging?

asp.net asp.net-mvc entity-framework entity-framework-6

Question

According to the manual, I can enable logging in the following way:

using (var context = new BlogContext())
{
    context.Database.Log = Console.Write;                       // like this
    context.Database.Log = logInfo => Debug.WriteLine(logInfo); // or like this

    // Your code here...

    // How can I turn off logging here ?
}

I can't find any instructions on how to disable it. Can someone please explain how to do this?

1
1
3/28/2014 10:12:06 AM

Accepted Answer

make a call

context.Database.Log = null;

Afterward, you turned off logging.

5
3/28/2014 10:25:31 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow