Share via


TracePrintf

[This Tracing API is available for use in the operating systems listed in the Requirements section. It may be altered or unavailable in subsequent versions. Instead use the Event Tracing API.]

The TracePrintf function outputs tracing information, including the following: calling service or application name, the current time, and tracing information in the format specified by the optional argument or arguments included in lpszFormat. See the note below for an example of TracePrintf results.

DWORD TracePrintf(
  DWORD dwTraceID,
  LPCTSTR lpszFormat,
   ...
);

Parameters

  • dwTraceID
    [in] Handle returned by the calling service or application's initial TraceRegister call.
  • lpszFormat
    [in] Pointer to a null-terminated string that contains printf-style format control information.
  • ...
    [in] Specifies one or more optional arguments that depends on the format control specified in lpszFormat.

Return Value

If the function succeeds, TracePrintf returns the number of characters output, excluding the terminating null-character.

If the function fails, the return value is zero. This may also indicate that tracing is disabled in the registry. See Tracing Configuration for more information.

Remarks

The following is an example for the output from TracePrintf. In the following example, the service or application calling TracePrintf is IPRIP, and its associated thread identifier for use with the RRAS tracing functionality is 129:

[IPRIP:129] 21:01:20: new entry: dest=0.0.0.0, nexthop=157.55.80.1, metric=1, protocol=2
[IPRIP:129] 21:01:20: received RIP v1 response from 157.55.84.244 on address 157.55.94.40

To suppress the prefixes, use TracePrintfEx.

Requirements

Server Requires Windows Server 2003 or Windows 2000 Server.
Redistributable Requires RRAS download on Windows NT Server 4.0 SP3 and later.
Header

Declared in Rtutils.h.

Library

Use Rtutils.lib.

DLL Requires Rtutils.dll.
Unicode

Implemented as TracePrintfW (Unicode) and TracePrintfA (ANSI).

See Also

About Tracing
Tracing Reference
TracePrintfEx
TraceRegister
TraceDeregister
TraceVprintf
TracePuts
TraceDump