HomeDev guideAPI Reference
Dev guideUser GuidesLegal TermsNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Logging

Describes logging for an integrated solution with Optimizely Search & Navigation and Optimizely Content Cloud (CMS).

📘

Note

To investigate and resolve issues, you should turn on logging for your application.

The Logging API shipped with Optimizely Content Management System (CMS) is an abstraction for writing log messages from the system. It is used internally by the CMS assemblies for logging.

When creating CMS sites using the Visual Studio integration, it installs the EPiServer.Logging.Log4Net package by default, which is the log4net implementation of the API. Optimizely Search & Navigation also uses the log4net framework.

To activate logging, add an appender and a logger in the EPiServerLog.config, located by default in the web root of your CMS or Optimizely Customized Commerce application, for the EPiServer.Find namespace.

<appender name="FindRollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
   <file value="find.log" />
   <appendToFile value="true" />
   <datePattern value=".yyyyMMdd.'log'" />
   <rollingStyle value="Date" />
   <filter type="log4net.Filter.LevelRangeFilter">
      <acceptOnMatch value="true" />
      <levelMin value="INFO" />
      <levelMax value="FATAL" />
   </filter>
   <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date %level [%thread] %type.%method - %message%n" />
   </layout>
</appender>
<logger name="EPiServer.Find">
   <appender-ref ref="FindRollingLogFileAppender" />
</logger>

If your application does not have an EPiServerLog.config, create one in your application's web root folder and add the logger and appender there.

<?xml version="1.0" encoding="utf-8"?>
<log4net>
<appender name="FindRollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
   <file value="find.log" />
   <appendToFile value="true" />
   <datePattern value=".yyyyMMdd.'log'" />
   <rollingStyle value="Date" />
   <filter type="log4net.Filter.LevelRangeFilter">
      <acceptOnMatch value="true" />
      <levelMin value="INFO" />
      <levelMax value="FATAL" />
   </filter>
   <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date %level [%thread] %type.%method - %message%n" />
   </layout>
</appender>
<logger name="EPiServer.Find">
   <appender-ref ref="FindRollingLogFileAppender" />
</logger>
</log4net>

See also Write log messages.