Share via


Commerce Foundation CommerceLogEntry CommerceCreate

The purpose of this operation is to log errors, warnings or information. This can be used by any consumer of the Microsoft Multi-Channel Commerce Foundation service.

Syntax

        var logEntryCreate = new CommerceCreate<CommerceEntity>("CommerceLogEntry");
      

Operation Sequence Components

Operation Sequence Component

Description

CommerceLogEntryCommitter

Commits the newly created entry into the log file.

Set Listeners

You must set Listeners in the ChannelConfiguration.xml file to listen for events. The source name should match the Trace layer attribute of the message handler configuration.

For example:

<source name="Microsoft.Commerce.Trace.Client" switchName="CommerceFoundationTraceSwitch">
        <listeners>
          <add name="EventLogExceptionsListener" type="System.Diagnostics.EventLogTraceListener" traceOutputOptions="None" initializeData="Commerce Foundation API Test">
            <filter type="System.Diagnostics.EventTypeFilter" initializeData="Error,Warning,Information" />
          </add>
        </listeners>
      </source>
…

Return Value

A successful operation will return a CommerceCreateOperationResponse containing a CommerceEntity based on the ReturnModel passed to the operation.

Exceptions

The following exception can be thrown by Microsoft Multi-Channel Commerce Foundation during this operation:

  • FaultException<GeneralOperationFault> - Indicates an operation has resulted in an internal exception being thrown. Details are logged in the event viewer.

Example

The following sample shows how to configure the message handler in the ChannelConfiguration.xml file:

<MessageHandler name="CommerceCreateOperation_CommerceLogEntry"
         responseType="Microsoft.Commerce.CommerceCreateOperationResponse, Microsoft.Commerce, Version=9.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35">
        <OperationSequence>
          <Component name="Authorization" type="Microsoft.Commerce.SequenceComponents.Components.AuthorizationSequenceComponent, Microsoft.Commerce.SequenceComponents, Version=9.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35"/>
          <Component name="CommerceLogEntry Silverlight Committer" type="Microsoft.Commerce.SequenceComponents.Components.CommerceLogEntryCommitter, Microsoft.Commerce.SequenceComponents, Version=9.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35">
            <Configuration
              customElementName="CommerceLogEntryCommitterConfiguration"
              customElementType="Microsoft.Commerce.SequenceComponents.Components.CommerceLogEntryCommitterElement, Microsoft.Commerce.SequenceComponents, Version=9.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35">
              <CommerceLogEntryCommitterConfiguration traceLayer="Client" enabled="true" />
            </Configuration>
          </Component>
        </OperationSequence>
      </MessageHandler>

See Also

Other Resources

Developing with the Multi-Channel Commerce Foundation