How do I make CloudConfigurationManager.GetSetting less verbose?

后端 未结 8 1407
天命终不由人
天命终不由人 2021-01-04 01:05

I\'m currently using CloudConfigurationManager.GetSetting(\"setting\") to get settings for my application, but it\'s writing logs of everything it\'s checking to the console

相关标签:
8条回答
  • 2021-01-04 01:48

    We just ran into this ourselves...so very frustrating.

    We can't remove the default listener because we are logging our own stuff on it.

    There is an easy workaround though. Just use the good old fashioned ConfigurationManager.AppSettings["Microsoft.ServiceBus.ConnectionString"] and you will get the info you need without the annoying logging.

    Hope that helps, David

    0 讨论(0)
  • 2021-01-04 01:49

    There are two separate issues here:

    1. Setting values are logged in plain text (a security concern)
    2. Messages are logged every time a setting is retrieved (a verbosity concern)

    As others have noted, #1 has been fixed in a more recent version of the plugin.

    Based on my experience (and some of the other responses here), #2 is still a huge annoyance.

    Looking at WADLogsTable in Visual Studio's Queue Editor, note that the message level is 5 (i.e. verbose, according to this list of ETW levels).

    Going off of the diagnostic config file schema, my approach to solving issue #2 was to limit the minimum severity level (e.g. warning, informational, verbose) of generic tracing to "information" (or more severe) and just ensure my own logging did not use the "verbose" level.

    Here is the change I made in diagnostics.wadcfgx:

    Original:

    <Logs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Verbose" />
    

    Fixed:

    <Logs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Information" />
    
    0 讨论(0)
提交回复
热议问题