Skip to main content

This version of the product is no longer supported, and this documentation is no longer updated regularly. See the latest version of this content.Opens in a new tab

Enabling Logging Dynamically

You can use your configuration file to enable and disable logging dynamically. Using the example configuration file from the earlier page, your code needs only to test the value of logging in the configuration file. For example, in your code that initializes the connection you would enable logging with the following code:


private void InitConnection()
{
    ...
    
    if (ConfigurationManager.AppSettings.Get("logging").Equals("yes"))
            {
               cacheConnectStr += 
               ";LogFile = " + ConfigurationManager.AppSettings.Get("logfile");
            }
            
    ...
}

FeedbackOpens in a new tab