Logging Web Providers

In CCF, logging follows the Provider design pattern. All logging is written through the ILogging interface. The parameters used to log the different types of messages are described next.

For error messages:

  • applicationName – Name of the application to be logged.
  • message – Message that needs to be logged along with the application name.
  • advanced – Any advanced message information that needs to be logged.

For warning, information, and trace messages:

  • applicationName – Name of the application to be logged.
  • message – Message that needs to be logged along with the application name.

The different approaches to capturing logs are described in the following sections. Each method has a function to initialize the logging listener. The function takes parameters as NameValueCollection under the Systems.Collection.Specialized namespace from the configuration file, and logs the entire message (information, error, warning, or trace) in the specified source.


CCF can log messages in a log file at a particular location on the hard disk. A logged message can be an error message, a warning, information, or a trace. To specify a log file location on the local computer you must modify the configuration file.

Use the following values to configure a local log file:

  • logfile – The location and name of the log file where the messages will be logged (for example, x:\logging\ccflog.txt).
  • appname – The name of the application that will log the messages.

 Messages are captured in the Windows event log. The event log uses the following values:

  • logname – The name of the event log.
  • appname – The name of the application name that will log the messages.

If the MessageBox value is set to true in the configuration file, error messages are captured and displayed in a message box. Depending on the message type (error, warning, or information), the appropriate icon and number of buttons are also displayed.


The Simple Mail Transfer Protocol (SMTP) logging system allows CCF to send information to an e-mail or pager server. This system can be used in conjunction with the Web service logging system. The ID logs the messages in the Web service logging system, and then the SMTP logging system uses e-mail to forward the messages to a recipient. Errors can be sent by e-mail, while other types of logs (trace and information) are written to the event log or a file. The SendOn flag tells the SMTP logging system to send an e-mail message for a specific type of event—for example, if a warning occurs. However, if the SMTP App.config file specifies that e-mails are not to be sent for a warning, then no e-mail message is sent.

The SMTP logging system uses the following values:

  • smtpServer – The SMTP Server address.
  • subjectTemplate –A string (template) for the subject, the default is {0}, which indicates not to use the template. A value of {1}, indicates that the template should be used. The default is the recommended setting.
  • sendTo –The address where the e-mail message will be sent.
  • sendFrom – The address from which the e-mail is sent.
  • sendOnError – A flag indicating whether an e-mail should be sent for errors.
  • sendOnWarn – A flag indicating whether an e-mail should be sent for warnings.
  • sendOnInformation – A flag indicating whether an e-mail should be sent for information logs.
  • sendOnTrace – A flag indicating whether an e-mail should be sent for trace logs.

The logging Web service provider system (Microsoft.Ccf.Common.Logging.Providers.WebService) is used in conjunction with the Web service logging system (ContactCenterAIF\Logging.svc). The logging Web service allows the ID to send its logs to the Web service provider. The Web service then sends the logs to the appropriate recipients.

Example 1:

  1. The ID has an error and sends a log message to the Web service that is defined in its App.config file. (All other logging listeners are removed or commented out.)
  2. The Web service receives the error, and sends an SMTP log to notify tech support that an error has occurred. Tech support receives the log as a Web page. The Web service also writes the log in the event log. Both the SMTP and the event log logging listeners are configured in the Web service’s Web.config file.

Example 2:

  1. The ID has a warning and sends a log message to the Web service that is defined in its App.config file.
  2. The Web service receives the warning; however, because the configuration for the SMTP log is set to fire only if there is an error, the e-mail message is not sent and the warning is entered in the event log only.

Technical support personnel can turn on file logging on an ID and turn off SMTP logging while they review and test a problem. This allows the logs to go to a local file for easier and quicker review. Once corrected, the App.config reverts to normal logging.


The logging Web service uses the LoggingUrl to identify the URL from which the message was sent.


You can use a configuration file to configure and store logging providers or you can use the Admin Console to configure and store them in the CCFInfrastructure database. By default, messages are sent to a log file. However, you can use the configuration file or the Admin Console to add other listeners, as shown in the following example.


                    <Common.Listeners>
    <listeners>
        <add name="LoggingLogFile" type="Microsoft.Ccf.Common.Logging.Providers.LoggingLogFile, Microsoft.Ccf.Common.Logging.Providers" logfile="c:\CCF.log" appname="Contact Center Framework"/>
    </listeners>
</Common.Listeners>

                  

Show: