Cache Logging

What is Logged

If the eWeb/xWeb SQLDependency problems cannot be attributed to the custom folder issue, then log4net logs debug entries that should help isolate the cause of the problem.

  1. At the point where we try to turn on SQLDependency, we log the following:
    1. Whether SQL Broker is turned on or off. (SQL Broker must be on for SQLDependency to work.)
    2. Turning on SQLDependency notifications requires a successful call to System.Data.SqlClient.SqlClientPermission(PermissionState.Unrestricted). We log the result of this call.
  2. We only turn on the SQLDependency if Config.EnableSQLDependency is turned on. We log if this is turned off.
  3. We log all the steps from the time the SQLDependency notification is received through to the calls to flush the cache. So if the notification is working, we should be able to see where it fails before getting to the cache flush.

 

Activating Logging

Modify the iWeb, eWeb, and xWeb web.config files as follows.

  1. Check that the following entry exists in <configSections> (if not, add it)

    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>

  2. In the <log4net> section, add the following (changing the high-lighted values to eweb/iweb/xweb accordingly

  3. You can copy the code below and modify it:
    <logger additivity="false" name="CacheProvider">
    <level value="DEBUG" /> <!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
    <appender-ref ref="CacheProvider_eweb"/>
    </logger>
    <appender name="CacheProvider_eweb" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="CacheProvider_eWeb-Log.txt"/>
    <param name="AppendToFile" value="true"/>
    <rollingStyle value="Size"/>
    <maxSizeRollBackups value="10"/>
    <maximumFileSize value="10MB"/>
    <staticLogFileName value="true"/>
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
    <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date %-5level %.1level %logger (%file:%line) - %message%newline"/>
    </layout>
    </appender>
  4. Save the web.config files. The application pool recycles. This will cause the SQL Dependency to reinitialize in each application (iWeb, eWeb, and xWeb) with the logging now active.

Finding the Information Logged

Log4net places the new log files in the following locations:

  • eweb\CacheProvider_eWeb-Log.txt
  • iweb\CacheProvider_iWeb-Log.txt
  • xweb\CacheProvider_xWeb-Log.txt

These log files contain only log entries related to the CacheProvider.

Troubleshooting Using the Logs

  1. Review the contents of the log files, and verify if any of the steps failed.
  2. Adjust the configuration accordingly.
  3. Recycle the Application Pool to re-initialize the SQL Dependencies.
  4. Review the log files.
    Once the log files report that the SQL Dependency was successfully started, try editing the metadata in iWeb again (something simple and obvious like changing a label or heading.) If this change is not reflected in eWeb or xWeb, check the log files again. They should contain a record of the steps that occurred in eWeb and xWeb once the SQL Dependency notification was received. Also check the standard error log (fw_error_log table) for any other errors.