Help me disable EF log output from results tab.

Is there any way I can turn on and off the EF detailed log output on the results tab?


  • Does the following work?


  • edited July 2023

    Unfortunately no. I still get the messages.

    I've tried several approaches. I ensured that the CsMesDataContext both in the script and in the external project I'm connecting to has EnableDetailedErrors and EnableSensitiveDataLogging explicitly turned off. Because I'm unfamiliar with EF, I also tried to send LogTo() to a NOP lambda in case that would help.

    But it didn't work. The connection is configured like this:

  • Is it possible that you have code such as the following in your context?

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        => optionsBuilder.LogTo(Console.WriteLine);

    If so, the following LINQPad code should disable that:

    Console.SetOut (TextWriter.Null);

  • I don't have LogTo defined. I had tried before to set it to

    options.LogTo(_ => {});

    But that didn't work either. However, your Console.SetOut suggestion did work, regardless. Thanks!

    I'm still unsure as to what's causing the output. But glad I have this workaround.

Sign In or Register to comment.