To investigate and resolve issues, it is always good to turn on logging for your application. This topic describes logging for an integration of Episerver Find with Episerver 7.5+ CMS.
How it works
The Logging API shipped with Episerver is an abstraction for writing log messages from the system, and is used internally by the Episerver assemblies for all logging.
When creating new CMS sites using the Visual Studio integration, the package EPiServer.Logging.Log4Net is installed by default, which is the log4net implementation of the API. Episerver Find also uses the log4net framework.
Activating logging
To activate logging, add an appender and a logger in the EPiServerLog.config, located by default in the web root of your Episerver application, for the EPiServer Find namespace.
XML
<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
<?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>
Related topic