Project Description
log4net Dynamics CRM 2011 Appender

Dynamics CRM Connection Configuration Sample

http://msdn.microsoft.com/en-us/library/gg695810.aspx

On Premise

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="Crm" connectionString="Url=https://domain.com/orgname; Domain=domain; Username=username; Password=password"/>
  </connectionStrings>
</configuration>

On Premise IFD deployment

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="Crm" connectionString="Url=https://orgname.domain.com; Username=domain\username; Password=password"/>
  </connectionStrings>
</configuration>

* Appender Simple Configuration Sample

<connectionStrings>
	<add name="Crm" connectionString="Url=https://orgname.domain.com; Username=domain\username; Password=password"/>
</connectionStrings>

<appender name="DynamicsCrm2011AppenderSimple" type="ZhongchenZhou.log4net.Appender.DynamicsCrm2011Appender, ZhongchenZhou.log4net.Appender">
    <!--<CrmConnectionStringName value="Crm" />-->
    <CrmConnectionString value="Url=https://domain.com/orgname; Domain=domain; Username=username; Password=password" />
    <EntityName value="zzhou_log4netsimplelog" />
    <parameter>
		<parameterName value="zzhou_level" />
		<layout type="log4net.Layout.PatternLayout">
			<conversionPattern value="%level" />
		</layout>
    </parameter>
    <parameter>
		<parameterName value="zzhou_formattedmessage" />
		<layout type="log4net.Layout.PatternLayout">
			<conversionPattern value="%timestamp %newline [%thread] %newline %level %newline %logger %newline %message" />
		</layout>
    </parameter>
</appender>
  • Appender Detail Configuration Sample

	<connectionStrings>
		<add name="Crm" connectionString="Url=https://orgname.domain.com; Username=domain\username; Password=password"/>
	</connectionStrings>

     <appender name="DynamicsCrm2011Appender" type="ZhongchenZhou.log4net.Appender.DynamicsCrm2011Appender, ZhongchenZhou.log4net.Appender">
      <CrmConnectionStringName value="Crm" />
      <EntityName value="zzhou_log4netlog" />
      <parameter>
        <parameterName value="zzhou_appdomainname" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%appdomain" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_aspnetcache" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%aspnet-cache" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_aspnetcontext" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%aspnet-context" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_aspnetrequest" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%aspnet-request" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_aspnetsession" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%aspnet-session" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_date" />
        <layout type="log4net.Layout.RawTimeStampLayout" />
      </parameter>
      <parameter>
        <parameterName value="zzhou_utcdate" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%utcdate" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_exception" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%exception" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_level" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%level" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_logger" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%logger" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_message" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%message" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_machinename" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%property{log4net:HostName}" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_stacktrace" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%stacktrace" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_stacktracedetail" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%stacktracedetail" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_threadname" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%thread" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="zzhou_formattedmessage" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%timestamp %newline [%thread] %newline %level %newline %logger %newline %message" />
        </layout>
      </parameter>
    </appender>









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