Project Description

log4net SharePoint 2013 Appender

This project contains two SharePoint List Templates, one is for simple configuration
and the other is for detail configuration.

You can create your own list as long as the list title and column title are configured correct.

* Appender Simple Configuration Sample

    <appender name="SharePoint2013AppenderSimple" type="ZhongchenZhou.log4net.Appender.SP.SharePoint2013Appender, ZhongchenZhou.log4net.Appender.SP">
      <SiteUrl value="http://sp13f/log4net" />
      <ListName value="log4net Simple Log" />
      <Domain value="domain" />
      <Username value="username" />
      <Password value="password" />
      <parameter>
        <parameterName value="Level" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%level" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Formatted Message" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%timestamp %newline [%thread] %newline %level %newline %logger %newline %message" />
        </layout>
      </parameter>
    </appender>

* Appender Detail Configuration Sample

     <appender name="SharePoint2013Appender" type="ZhongchenZhou.log4net.Appender.SP.SharePoint2013Appender, ZhongchenZhou.log4net.Appender.SP">
      <SiteUrl value="http://sp13f/log4net" />
      <ListName value="log4net log" />
      <Domain value="domain" />
      <Username value="username" />
      <Password value="password" />
      <parameter>
        <parameterName value="App Domain Name" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%appdomain" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="ASP.NET Cache" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%aspnet-cache" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="ASP.NET Context" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%aspnet-context" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="ASP.NET Request" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%aspnet-request" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="ASP.NET Session" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%aspnet-session" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Date" />
        <layout type="log4net.Layout.RawTimeStampLayout" />
      </parameter>
      <parameter>
        <parameterName value="UTC Date" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%utcdate" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Exception" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%exception" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Level" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%level" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Logger" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%logger" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Message" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%message" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Machine Name" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%property{log4net:HostName}" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Stack Trace" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%stacktrace" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Stack Trace Detail" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%stacktracedetail" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Thread Name" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%thread" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="Formatted Message" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%timestamp %newline [%thread] %newline %level %newline %logger %newline %message" />
        </layout>
      </parameter>
    </appender>

Last edited Dec 9, 2012 at 8:39 AM by zzc000, version 2