Configuring logging in the fcSDK without a config file
May 14, 2007
I banged my head against this for a while today, so I figured a post was in order. I was writing a PowerShell script to re-create a customer scenario today, and I needed to enable debug level logging. I was building the config on the fly, such as this: $config = new-object -typename System.Collections.Specialized.NameValueCollection $config.Add("fchoice.connectionstring",$connectionString); $config.Add("fchoice.dbtype",$databaseType); $config.Add("fchoice.disableloginfromfcapp", "false"); $ClarifyApplication = [Fchoice.Foundation.Clarify.ClarifyApplication] if ($ClarifyApplication::IsInitialized -eq $false ){ $ClarifyApplication::initialize($config) > $null; } I created a logging.config file that looks like: Then added to my config: $config.Add("fchoice.logconfigfile", "C:\customers\test\logging.config"); I ran my script, but I didn't get a log file. I went back to the fcSDK docs on logging configuration, and realized what was happening. The LogManager is a singleton, and only gets its LogConfigFilePath set upon initialization. So, it has to be set before its initialized. However, the fcSDK does logging when parsing…