> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XtfCaptureOutputBegin

> XtfCaptureOutputBegin

# XtfCaptureOutputBegin

Starts capture of debug output.

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
void XtfCaptureOutputBegin(
         PCWSTR address,
         XtfDebugStringCallback debugStringCallback,
         XtfDebugStringErrorCallback debugStringErrorCallback,
         PVOID context,
         PHANDLE hListen
)  
```

<a id="parametersSection" />

### Parameters

*address*\
Type: PCWSTR

\[in] The IP address of the console.

*debugStringCallback*\
Type: [XtfDebugStringCallback](/reference/tools/xtf/xtfapi/functions/xtfdebugstringcallback-xtfapi-xbox-windows-m)

\[in, optional] An optional callback invoked for each output debug string.

*debugStringErrorCallback*\
Type: [XtfDebugStringErrorCallback](/reference/tools/xtf/xtfapi/functions/xtfdebugstringerrorcallback-xtfapi-xbox-windows-m)

\[in, optional] An optional callback invoked for each error encountered.

*context*\
Type: PVOID

\[in, optional] A pointer to an object that is passed into the callback functions. This object allows each callback invocation to be associated with this capture session.

*hListen*\
Type: PHANDLE

\[out] The handle that represents this capture session.

<a id="retvalSection" />

### Return value

None.

<a id="remarksSection" />

## Remarks

Use this function and the [XtfCaptureOutputEnd](/reference/tools/xtf/xtfapi/functions/xtfcaptureoutputend-xtfapi-xbox-windows-m) function to start and stop capturing general debug output from a development console. If you want to monitor debug output from a specific process ID on a development console, use a debug monitor client. For more information about using a debug monitor client, see [XtfCreateDebugMonitorClient](/reference/tools/xtf/xtfdebugmonitor/methods/xtfcreatedebugmonitorclient-xtfdebugmonitor-xbox-microsoft-m).

You must implement and specify a `XtfDebugStringCallback` function in `debugStringCallback` if you want to capture debug strings for a capture session. Similarly, you must implement and specify an `XtfDebugStringErrorCallback` function in `debugStringErrorCallback` to capture errors encountered during a capture session. Neither callback function is required, however.

To stop capturing debug output and free the resources associated with a capture session, call [XtfCaptureOutputEnd](/reference/tools/xtf/xtfapi/functions/xtfcaptureoutputend-xtfapi-xbox-windows-m) and specify the handle returned in `hListen` for that capture session.

<Note>You must call `XtfCaptureOutputEnd` to stop a capture session. Otherwise, the capture session is orphaned and the resources associated with the capture session are not freed, causing a memory leak.</Note>

<a id="requirements" />

## Requirements

**Header:** xtfapi.h

**Library:** XtfApi.lib

**Supported platforms:** Windows (for XBOX console tools)

<a id="seealsoSection" />

## See also

[IXtfDebugMonitorClient Interface](/reference/tools/xtf/xtfdebugmonitor/classes/IXtfDebugMonitorClient/ixtfdebugmonitorclient-xtfdebugmonitor-xbox-microsoft-t)\
[XTF Transport Errors (NDA topic)](/tools/tools-console/commandlinetools/xtf-transport-errors)\
[Additional Xtf APIs](/reference/tools/xtf/xtfapi/atoc-xtfapi)


## Related topics

- [XtfCaptureOutputEnd](/reference/tools/xtf/xtfapi/functions/xtfcaptureoutputend-xtfapi-xbox-windows-m.md)
- [XtfDebugStringCallback](/reference/tools/xtf/xtfapi/functions/xtfdebugstringcallback-xtfapi-xbox-windows-m.md)
- [XtfDebugStringErrorCallback](/reference/tools/xtf/xtfapi/functions/xtfdebugstringerrorcallback-xtfapi-xbox-windows-m.md)
- [XtfCaptureScreenshot](/reference/tools/xtf/xtfconsolecontrol/functions/xtfcapturescreenshot.md)
- [PIXEndCapture](/reference/tools/pix3/functions/pixendcapture.md)
