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 (in both Debug and Release):
Getting "setting" from ServiceRuntime: FAIL.
Getting "setting" from ConfigurationManager: PASS (Data Source=...
Getting "setting" from ServiceRuntime: FAIL.
Getting "setting" from ConfigurationManager: PASS (Data Source=...
Is there any way to prevent it from doing this, or an alternative version that’s less verbose?
Mostly I just like my unit test output to be nice and clean, but I’m also a little concerned that it’s printing out things like connection strings (and hence passwords) in plain text on the production server.
Not really. If you look at the code of the underlying
GetValuemethod you’ll see this:The Trace.WriteLine is always called without taking into account Debug or Release. Now you can simply remove the Default listener which should suppress all messages:
Now if you look at the
CloudConfigurationManagerit doesn’t do that much. If this is a problem for you you can cook up something yourself, starting with this:Note: The CloudConfigurationManager does a lot more than this, like loading the assembly without assembly reference.