<?xml version="1.0" encoding="utf-8"?>
<log4net>
  <!-- LogAppender used to send log messages to the Log Service
        Values:
        encoding      - has to be set to Unicode
        remoteAddress - ip-address for your log service
        remotePort    - has to be set to the same port as defined in 
                        'udpClientPort' in the configuration file for the log service
                        located in the file %PROGRAMFILES%/EPiServer.LogService5/EPiServer.Log.Service.exe.config
    -->
  <appender name="StatisticsUdpAppender" type="EPiServer.Diagnostics.EPiServerUdpAppender, EPiServer">
    <remoteAddress value="127.0.0.1" />
    <remotePort value="7071" />
  </appender>

  <appender name="fileLogAppender" type="log4net.Appender.FileAppender" >
    <!-- The path is relative to the application base, i.e. the EPiServerSample directory. ASP.NET Machine Account must have modify rights there.
         You probably do NOT want to place it in the application base directory, as it is potentially avaialable to Web site vistors.
         DO CHANGE THE LOCATION BELOW FOR PRODUCTION SYSTEMS -->
    <file value="EPiServerErrorLog.txt" />
    <!-- Typical encoding values are Unicode/utf-16 or utf-8 or ascii. See System.Text.Encoding for more info. Omit this tag to get the system default Ansi -->
    <!-- Use utf-8 for the file appender to conform to EPiServer practices and reduce log file size -->
    <encoding value="utf-8" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <appendToFile value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <!-- You should be aware that generating type and method information is very SLOW -->
      <conversionPattern value="%date %level [%thread] %type.%method - %message%n" />
    </layout>
  </appender>

  <!-- Try the logview4net utility to listen to UDP-logs, download from sourceforge.net -->
  <appender name="udpLogAppender" type="log4net.Appender.UdpAppender" >
    <!-- Typical encoding values are Unicode/utf-16 or utf-8 or ascii. See System.Text.Encoding for more info. Omit this tag to get the system default Ansi -->
    <!-- Use utf-16 since it's default for logvivew4net -->
    <encoding value="utf-16" />
    <!-- Be careful where you send the logs, they may contain sensitive data. You can use 224.0.0.1 for the local net -->
    <remoteAddress value="127.0.0.1" />
    <remotePort value="8082" />
    <layout type="log4net.Layout.PatternLayout">
      <!-- You should be aware that generating type and method information is very SLOW -->
      <conversionPattern value="%date %level [%thread] %type.%method - %message%n%exception" />
    </layout>
  </appender>
  
  <!-- The RollingFileAppender will create new files according to the settings, typically once every day for example -->
  <appender name="fileStatisticsAppender" type="log4net.Appender.RollingFileAppender">
    <!-- The path is relative to the application base, i.e. the EPiServerSample directory. ASP.NET Machine Account must have modify rights there.
         You probably do NOT want to place it in the application base directory, as it is potentially avaialable to Web site vistors.
         DO CHANGE THE LOCATION BELOW FOR PRODUCTION SYSTEMS -->
    <file value="EPiServerStatisticsLog.txt" />
    <!-- Typical encoding values are Unicode/utf-16 or utf-8 or ascii. See System.Text.Encoding for more info. Omit this tag to get the system default Ansi -->
    <!-- use ASCII to make it easy for other programs to interpret the contents of the statistics log -->
    <encoding value="ascii" />
    <lockingModel type="log4net.Appender.RollingFileAppender+MinimalLock" />
    <appendToFile value="true" />
    <rollingStyle value="Date" />
    <layout type="log4net.Layout.PatternLayout">
      <!-- You should be aware that generating type and method information is very SLOW -->
      <param name="ConversionPattern" value="%date|%message%n" />
    </layout>
  </appender>
  
  <!-- Statistics are sent to this logger, when enabled  -->
  <logger name="EPiServer.UI.Util.PixelImg">
    <!-- Statistics are sent as 'Info' level logs, set the level to "All" to enable logging, "Off" to disable statistics logging -->
    <level value="All" />
    <appender-ref ref="StatisticsUdpAppender" />
  </logger>

  <!-- Reduce amount of logging from OptimisticCache -->
  <logger name="EPiServer.Core.OptimisticCache" additivity="false">
    <level value="Error" />
  </logger>

  <!-- Reduce amount of logging from DataAccessBase -->
  <logger name="EPiServer.DataAccess.DataAccessBase" additivity="false">
    <level value="Error" />
  </logger>

  <!-- Error and general program flow logs are sent to the root logger. Note that all logs, including statistics if enabled,
       will be sent to these appenders as well -->
  <root>
    <!-- You can use levels, in increasing order of verbosity: Off, Fatal, Error, Warn, Info, Debug, All -->
    <level value="Warn" />
    <!-- Uncomment one or all of the appender-ref's, or add additional ones -->
    <!-- appender-ref ref="fileLogAppender" / -->

    <!-- LogView4net is a good application to use to listen to logging output via UDP. Find it on sourceforge. -->
    <!-- appender-ref ref="udpLogAppender" / -->
  </root>
</log4net>
