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

# XtfCaptureOutputBegin

> XtfCaptureOutputBegin

Starts capture of debug output.

## Syntax

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

### Parameters

*address*\
Type: PCWSTR

\[in] The IP address of the console.

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

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

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

\[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.

### Return value

None.

## Remarks

Use this function and the [XtfCaptureOutputEnd](https://docs.xbox.com/reference/tools/xtf/xtfapi/functions/xtfcaptureoutputend-xtfapi-xbox-windows-m.md) 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](https://docs.xbox.com/reference/tools/xtf/xtfdebugmonitor/methods/xtfcreatedebugmonitorclient-xtfdebugmonitor-xbox-microsoft-m.md).

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](https://docs.xbox.com/reference/tools/xtf/xtfapi/functions/xtfcaptureoutputend-xtfapi-xbox-windows-m.md) 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.

## Requirements

**Header:** xtfapi.h

**Library:** XtfApi.lib

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

## See also

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


## Related topics

- [XtfCaptureOutputEnd](https://docs.xbox.com/reference/tools/xtf/xtfapi/functions/xtfcaptureoutputend-xtfapi-xbox-windows-m.md)
- [Additional Xtf APIs (API contents)](https://docs.xbox.com/reference/tools/xtf/xtfapi/atoc-xtfapi.md)
- [XtfDebugStringCallback](https://docs.xbox.com/reference/tools/xtf/xtfapi/functions/xtfdebugstringcallback-xtfapi-xbox-windows-m.md)
- [XtfDebugStringErrorCallback](https://docs.xbox.com/reference/tools/xtf/xtfapi/functions/xtfdebugstringerrorcallback-xtfapi-xbox-windows-m.md)
- [IXtfDebugMonitorClient Interface (Interface contents)](https://docs.xbox.com/reference/tools/xtf/xtfdebugmonitor/classes/IXtfDebugMonitorClient/ixtfdebugmonitorclient-xtfdebugmonitor-xbox-microsoft-t.md)
