Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?

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");
            }
            
    ...
}
Feedback