How can I turn off Entity Framework 6.1 logging?

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

Question

The documentation states that I can turn on logging like this:

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 don't see any information on how to turn it off. Can someone tell me how I can do this?

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

Accepted Answer

Just call

context.Database.Log = null;

then you have turned of 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