Last updated: Nov 16 2015

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, then create one in the web root folder of your application 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

Comments