Azure / azure-kusto-dotnet

Azure Data Explorer (Kusto) SDK for .NET
MIT License
8 stars 5 forks source link

Package is constantly writing to console #13

Closed johan-ksat closed 1 year ago

johan-ksat commented 1 year ago

The package Microsoft.Azure.Kusto.Data is clogging up the console with tons of logs. We are using console logging provider and stores everything that's written to console. The package doesn't seem to use a logger, but rather more directly writing to console with Console.WriteLine or similar, so changing log level doesn't help.

Here's a screenshot from the logging in VS Code, the two upper logs (starting with P.*) are from the kusto package while the other two (tagged with info) are our own logs.

image

chriswue commented 1 year ago

I cannot confirm this, we don't see these logs in our console. We do use the Microsoft.Extensions packages DependencyInjection and Logging to wire everything up - maybe that makes a difference?

johan-ksat commented 1 year ago

We're using .NET 6 and implicit usings, so not really sure exactly what packages are used, but this is the only logging configuration that is done:

var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
builder.Logging.AddConsole();

And in appsettings:

  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "System": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  }

But as I mentioned it doesn't seems to be using the logging interface since log levels and such has no effect. It more looks like Console.WriteLine-calls.

johan-ksat commented 1 year ago

Adding this got rid of most of the logging, which is good enough for now:

TraceSourceManager.SetTraceVerbosityForAll(TraceVerbosity.Error);

But I still get logs from "Tweaks" when connecting to ADX:

image

johan-ksat commented 1 year ago

@yogilad Why close this without explanation? This is the only package I've seen outputting to console without using a logger, and it's really annoying not to be able to set the log level to get rid of it. Shouldn't it be fixed or looked into?

chriswue commented 1 year ago

I guess some of this is documented here but I haven't really played around with it: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/api/netfx/controlling-tracing