Try our conversational search powered by Generative AI!

Dmytro Duk
Jul 23, 2010
  5153
(1 votes)

Connect for SharePoint – logging configuration

In Connect for SharePoint 2.2 we use log4net for logging both on SharePoint and EPiServer CMS sides.

Logging on SharePoint side

You can enable logging to see debug information when items are being pushed from SharePoint to EPiServer CMS content channel.

Go to the home directory of your web application. By default WSS web application home directory can be found in your Inetpub folder:

C:\Inetpub\wwwroot\wss\VirtualDirectories\[web application port number]

Open web.config file, define log4net configuration section and configure logging.

Example configuration:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
 
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" /> 
  </configSections>  
 
  <log4net>
 
    <!--Appender to write message to debug output-->
    <appender name="OutputDebugStringAppender" type="log4net.Appender.OutputDebugStringAppender">
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %type.%method - %message%newline" />
      </layout>
    </appender>
 
    <!--Appender to write messages to file ConnectForSharePoint.log.txt in Logs directory. File will be created for each day-->
    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="Logs/ConnectForSharePoint.log.txt" />
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <datePattern value="yyyyMMdd " />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %type.%method - %message%newline" />
      </layout>
    </appender>
 
    <root>
      <level value="ERROR" />
      <appender-ref ref="OutputDebugStringAppender" />
      <appender-ref ref="RollingLogFileAppender" />
    </root>
 
  </log4net>
 
 </configuration>

Now you can see logs when item is added/updated/deleted or content is resent to EPiServer CMS:

DebugViewLogOnSharePoint

Logging on EPiServer CMS side

You can enable logging for virtual path provider for SharePoint and get debug information when CMS users are working with SharePoint files. Also you can debug how SharePoint items are imported with content channel.

On EPiServer CMS side you need to configure logging in EPiServerLog.config file.

You can use existing appenders or define new appenders to debug Connect for SharePoint module:

<?xml version="1.0" encoding="utf-8"?>
<log4net>
 
  <appender name="OutputDebugStringAppender" type="log4net.Appender.OutputDebugStringAppender">
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %type.%method - %message%newline" />
    </layout>
  </appender>
 
  <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
    <file value=" Logs/SharePointVPP.log.txt" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <appendToFile value="true" />
    <rollingStyle value="Date" />
    <datePattern value="yyyyMMdd " />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %type.%method - %message%newline" />
    </layout>
  </appender>
 
  <logger name="EPiServer.VirtualPathWssProvider">
    <level value="Debug" />
    <appender-ref ref="OutputDebugStringAppender" />
    <!--<appender-ref ref="RollingLogFileAppender" />-->
  </logger>
 
  <root>
    <level value="Warn" />
  </root>
</log4net>

In this example we have logger named EPiServer.VirtualPathWssProvider which uses 2 appenders to write messages to debug output and to files. Logger name means that this logger will write only messages output by code from namespace EPiServer.VirtualPathWssProvider.

If you want to see how your items are processed in content channel, you can define logger for EPiServer.ContentChannels namespace.

Of course you don’t need to have all debug messages logged to files in normal situation, use All and Debug levels only to debug some issues.

See http://logging.apache.org/log4net/index.html for details regarding log4net configuration.

Couple of tips regarding logs and debug

Make sure that application is allowed to write to file in your log directory if you are using file appender.

I prefer to use DebugView tool to read logs for debug purposes. You see messages in DebugView window in real time. You don’t need to think about access rights to write messages on disk. You don’t need reopen any log files to see new messages. It’s easy to filter messages in DebugView to see only required.

Jul 23, 2010

Comments

Please login to comment.
Latest blogs
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog