1

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?

  • 2
    If you inspect `context.Database.Log` before you assign to it, what do you see? You should be able to use that same value to reset it. (I don't know what that value is. It might be `null`, or it might be some method that ignores its argument.) –  Mar 28 '14 at 10:16

1 Answers1

5

Just call

context.Database.Log = null;

then you have turned of logging

Michael Mairegger
  • 6,833
  • 28
  • 41