다음을 통해 공유


How to Trace Commerce Server Events

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Commerce Server has been instrumented to use Event Tracing for Windows (ETW). You can enable tracing for individual Commerce Server components and examine the trace log to help debug problems.

Tracing Commerce Server Events

You can use the following to help you trace events.

  1. Open a command prompt and change to the %COMMERCE_SERVER_ROOT%\support directory.

  2. Start Notepad and edit the cstraceguids.ctl file.

  3. Type a "#" character in the first position of the row for each component that you do not want to trace. The only components whose trace messages you can format are as follows:

    • CommerceServer_Marketing: Trace events in the Marketing system.

    • CommerceServer_Orders: Trace events in the Orders system.

    • CommerceServer_Staging: Trace staging events.

    • CommerceServer_Catalog: Trace events in the catalog and inventory systems.

    • XMLTracer: Trace pipeline events. For more information about XMLTracer, see Starting, Stopping, and Formatting XMLTracer Output.

  4. Save the cstraceguids.ctl file.

  5. Enable tracing by running the tracelog program. The arguments to the tracelog program are described later in this topic. For example, to trace all levels of messages, type the following command:

    tracelog.exe -start cstrace -guid cstraceguids.ctl -f c:\temp\cstrace.log -flags 127 -ft 5 -b 512
    

    Note

    This example assumes that the directory c:\temp exists.

  6. Type iisreset to reset IIS.

  7. Run your Commerce Server application, and execute the scenario that you want to trace.

  8. Use the tracelog program to turn off tracing. For example, to turn off the trace that the example in step 5 turned on, type the following command:

    tracelog.exe -stop cstrace
    
  9. Run the tracefmt program to format the trace log. For example, to format the trace information that you collected at step 5, type the following command:

    tracefmt.exe -f c:\temp\cstrace.log -o c:\temp\formattedtrace.log -tmf "C:\Program Files\Microsoft Commerce Server 2007\Support\TraceFormat\CSTraceEvents.tmf"
    

    Note

    If you specified a different directory during the Commerce Server installation, replace "C:\ProgramFiles\Microsoft Commerce Server 2007" in the previous command by using the path to your installation. Leave the rest of the path the same.

Tracelog Syntax

Use the following command syntax to run the tracelog program:

Tracelog <action> <option>*

Where <action> can have one of the following values:

  • -start LoggerName: Starts the LoggerName trace session.

  • -stop LoggerName: Stops the LoggerName trace session.

  • -flush LoggerName: Flushes the LoggerName trace session.

  • -q: LoggerName: Queries the status of the LoggerName trace session.

  • -l: Lists all active trace sessions.

  • -x: Stops all active trace sessions.

    Note

    The default value of LoggerName is "Nt Kernel Logger".

Where <option> can have one of the following values:

  • -append: Appends to file.

  • -b size: Sets buffer size to size KB. The default buffer size is 4 KB.

  • -cir size: Uses a circular log file of size MB.

  • -f name: Sets log to file name. The default log file name is stored at C:\LogFile.Etl.

  • -flag bitmask: The bitmask flags control the level of events to trace.

    Use the following values to create the bitmask:

    • 0x1: Errors

    • 0x2: Warnings

    • 0x4: Information

    • 0x8: Verbose information

    • 0x10: Extra-verbose information

    • 0x20: SQL queries

    • 0x40: Segment lifetime

  • -ft time: Sets flush timer to time seconds.

  • -guid file: Starts the tracing for the components that are listed in file.

  • -rt: Enables tracing in real time mode.

Tracefmt Syntax

Use the following command syntax to run the tracelog program:

Tracefmt <option>*

Where <option> is one of the following values:

  • -f file: Specifies the trace log to format. The default file name is C:\logfile.etl.

  • -o file: Specifies where to save the formatted output. The default output file name is fmtfile.txt.

  • -tmf file: Identifies the file that contains the formatting rules. To trace Commerce Server events, use the value "C:\ProgramFiles\Microsoft Commerce Server 2007\Support\TraceFormat\CSTraceEvents.tmf".

    Note

    Do not use an environment variable such as %COMMERCE_SERVER_ROOT% in the file name.

  • -rt LoggerName: Formats the messages from the LoggerName trace session in real time.

  • -v: Uses verbose format.

See Also

Other Resources

Starting, Stopping, and Formatting XMLTracer Output

Troubleshooting Commerce Server Development