Log Messages

Smartsite 7.10 - ...

The Log Messages action displays all the log messages which have been written to the database. The number of records you see here depends on whether or not logging is/has been enabled and whether or not the log messages are written to the database, the filter settings, etcetera.

Use the Category and/or Type filter or enter a search term to investigate a specific set of log messages.

Enable logging

Logging is enabled and configured within the Smartsite.Logging.config. The manager and the publication engine both have their own logging configuration file, so the logging for each of them can be configured differently.

The logging configuration file for the manager is located within the WWWMgr folder, whereas the logging configuration file for the publication engine is located within the site root folder. The logging implementation uses a (trace) listener model to route log messages to one or more trace listeners, which can be configured separately for different categories. The implementation includes several different types of trace listeners: Database trace listener, EventLog trace listener, Xml file trace listener.

But if you just want to use the Database trace listener, the Smartsite.Logging.config could be like the example shown below.

XML CopyCode image Copy Code
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0" 
     xsi:schemaLocation="http://schemas.microsoft.com/.NetConfiguration/v2.0 System/Schemas/Configuration/smartsite.logging.config.xsd"  
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <configSections>
    <section name="loggingConfiguration"
        type="Smartsite.Diagnostics.LoggingBase.Logging.Configuration.LoggingSettings, Smartsite.Diagnostics.Logging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5fdb12a67e027fb6" />
    <section name="logwriterConfiguration"
        type="Smartsite.Diagnostics.Logging.LogWriterSettings, Smartsite.Diagnostics.Logging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5fdb12a67e027fb6" />
 </configSections>
 <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="" logWarningsWhenNoCategoriesMatch="true">
    <listeners>
       <add name="Database Trace Listener"
          type="Smartsite.Diagnostics.Logging.DBTraceListener, Smartsite.Diagnostics.Logging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5fdb12a67e027fb6"
          dbConnection="manager"
          dbLogEntriesTable="LogEntries"
          listenerDataType="Smartsite.Diagnostics.LoggingBase.Logging.Configuration.CustomTraceListenerData, Smartsite.Diagnostics.Logging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5fdb12a67e027fb6"
          traceOutputOptions="None"
          initializeData=""
       />
    </listeners>
    <categorySources>
    </categorySources>
    <specialSources>
       <allEvents switchValue="All" name="All Events">
          <listeners>
             <add name="Database Trace Listener"/>
          </listeners>
       </allEvents>
       <notProcessed switchValue="All" name="Unprocessed Category"/>
       <errors switchValue="All" name="Logging Errors">
          <listeners>
          </listeners>
       </errors>
    </specialSources>
 </loggingConfiguration>
 <logwriterConfiguration>
    <logging enabled="true" type="asynchronous" queueSize="1000"/> 
    <logfilter>
       <logtype name="Error" defaultminlevel="1" defaultmaxlevel="10">
          <filters>
             <filter category="Smi" minlevel="1" maxlevel="0" />
          </filters>
       </logtype>
       <logtype name="Warning" defaultminlevel="1" defaultmaxlevel="3">
          <filters>
          </filters>
       </logtype>
       <logtype name="Information" defaultminlevel="1" defaultmaxlevel="8">
          <filters>
             <filter category="ImageProcessor" minlevel="1" maxlevel="0" />
             <filter category="Spice" minlevel="1" maxlevel="0" />
          </filters>
       </logtype>
       <logtype name="Trace" defaultminlevel="1" defaultmaxlevel="5">
          <filters>
             <filter category="StateSync" minlevel="1" maxlevel="5" />
             <filter category="Security" minlevel="1" maxlevel="10" /> 
             <filter category="ImageProcessor" minlevel="1" maxlevel="0" /> 
             <filter category="Spice" minlevel="1" maxlevel="0" /> 
          </filters>
       </logtype>
    </logfilter>
 </logwriterConfiguration>
</configuration>

A quick explanation of the logging configuration file:

  • The configSections element defines the two other xml elements within the configuration file and specifies which types should be used to process them.
  • The loggingConfiguration element defines the listeners you want to use and contains configuration how to process the different types of log messages and to which listener(s) they should be routed.
  • The logwriterConfiguration element contains the log filters: which type of log messages (Error, Warning, Information and Trace) should be logged with a minimum and maximum log level as specified. Further filtering can be applied based on the log category.

Notice that the dbConnection attribute of the Database Trace listener should refer to an existing database connectionstring definition within the Smartsite.Data.config configuration file, located within the site root folder (see example below).

XML CopyCode image Copy Code
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0" 
      xsi:schemaLocation="http://schemas.microsoft.com/.NetConfiguration/v2.0 System/Schemas/Configuration/smartsite.data.config.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <smartsite.data>
     <databases>
        <database id="manager">
           <connectionstring>.....</connectionstring>
        </database>
     </databases>
     <storagehandlers>
        <handler id="DatabaseStorage" assembly="Smartsite.Data.DatabaseStorage, Smartsite.Data" />
        <handler id="ThesaurusStorage" assembly="Smartsite.Data.ThesaurusStorage, Smartsite.Data" />
        <handler id="ContentRelationStorage" assembly="Smartsite.Data.ContentRelationStorage, Smartsite.Data" />
        <handler id="FileStorage" assembly="Smartsite.Data.FileStorage, Smartsite.Data" />
        <handler id="FileLinkStorage" assembly="Smartsite.Data.FileLinkStorage, Smartsite.Data" />
     </storagehandlers>
  </smartsite.data>
</configuration>

Also, using the Database Trace listener for the manager requires Smartsite 7.10 or higher.

Filtered list

When logging to the database is enabled (for both the manager as the publication engine), the number of messages will increase very quickly.

You can of course delete a selection of log messages at a time, but as of Smartsite 7.10 there's a new option available: Filtered list.

This button will be enabled as soon as there is a filter applied (on e.g. Category and/or Type).

The way it works: select one or more filters and/or specify a search term and the (number of) results shown is the list of log messages you can remove by just clicking the Filtered list button.
Suppose you want to remove all the trace log messages coming from the ImageProcessor. In that case, select ImageProcessor as Category, select Trace as Type and click the Filterted list button.

A confirmation is shown, displaying the number of log messages that will be removed taking into account the filter settings. Click Ok to remove the log messages, click Cancel to abort.

Clean up

Another option (available as of Smartsite 7.10) to clean up the number of log messages is clicking the Clean up button. This will open the (generic) Clean up action, which in that case will specifically work on the Log messages table (LogEntries).

With the (generic) clean up action, you can remove records (in this case log messages) which are older than a selected period of time. An overview is shown, with the number of records that will be removed when you choose that specific period of time.

Just select one of the options and click the Delete button. Notice that the delete operation will be executed right away when clicking the Delete button, there's no confirmation dialog inbetween.

You must have access right on the user action with code mgr-LOGENTRIES_CLEANUP, otherwise the Clean up button will not be available.