Cinchoo – Configuration Framework, Part 31

Disable logging

Cinchoo is an application framework for .NET. One of the main functionality it provides to users is application configuration management. Application configuration is the information that an application reads and/or writes at run-time from the source.

Please visit jump start article [Cinchoo – Simplified Configuration Manager] for more information about Cinchoo configuration manager.

In this section, I’ll show to disable logging of Cinchoo framework produces. Open a app.config file from your project. Add the below section

<configuration>
 <system.diagnostics>
   <switches>
     <add name="ChoSwitch" value="0" />
   </switches>
 </system.diagnostics>
</configuration>

ChoSwitch is a TraceSwitch, you can assign different levels to it to specify the types of trace or debug messages the application outputs. Setting the value to “0” will disable all the logging of the framework.

Other possible values can be assigned to control the output of the logs

  • 0 – Off
  • 1 – Error
  • 2 – Warning
  • 3 – Info
  • 4 – Verbose
Advertisements

3 thoughts on “Cinchoo – Configuration Framework, Part 31

  1. Nice framework! Thanks for this article!
    Please, answer additional questions:
    1. How to make the same programmatically (in the code)?
    2. How to disable the creation of some strange files in bin/config folder like ChoAPMSettings.xml, ChoCoreFrx.xml, Meta folder etc?

    1. Thanks for your valuable comments. Here are the answers to your questions

      1. How to make the same programmatically (in the code)?

      Subscribe to ChoApplication.ApplyGlobalApplicationSettingsOverrides event in the Main() entry method.
      In the event handler add the below statement

      static void ChoApplication_ApplyGlobalApplicationSettingsOverrides(object sender, ChoEventArgs e)
      {
      ChoTraceSwitch.Switch.Level = TraceLevel.Off;
      }

      2. How to disable the creation of some strange files in bin/config folder like ChoAPMSettings.xml, ChoCoreFrx.xml, Meta folder etc?
      You can’t at this time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s