Overview
Steam has grown into a large application over the years and provides many separate modules and multiple different ways to debug. This page outlines as many of them as possible to help you get the most out of Steam and Steamworks while keeping headaches to a minimum.
Steam automatically outputs a number of debug to the
logs
folder, for others you may need to use
Steam Command Line Parameters or
Steam Console Commands to enable them.
Using
ISteamUtils::SetWarningMessageHook allows a Steamworks application to register a function that allows the Steamworks API to provide human-readable error messages to the application when something goes wrong. Most Steam APIs use it, so be sure to hook it up and look at it any time something goes wrong.
Steam Command Line Parameters
Steam uses command line parameters to expose developer details.
- -console - Enables the Steam console. The console provides additional debugging information and allows you to use Steam Console Commands. This can also be enabled by navigating to steam://open/console in a browser or through the Windows Run dialog.
- -debug_steamapi - Enables Steamworks API debugging. This is required if you are wanting to use ISteamUtils::SetWarningMessageHook!
- -lognetapi - Logs all P2P networking info to
log/netapi_log.txt
.
- -log_voice - Writes voice chat data to the
logs/voice_log.txt
file
- -installer_test - Changes installing a retail game to emit all files to the
install_validate/
folder instead of to the steam cache.
Steam Console Commands
In addition to providing additional output for error reporting or logging, the Steam console can also be used to issue commands to the steam client or servers. Here are a few commands which are useful for debugging purposes.
- find <string> - Lets you find other useful commands
- set_spew_level - Enables you to set a higher level of output in the steam console as well as log files. ex: "set_spew_level 4 4" - provides the most verbose logging and is very useful for troubleshooting problems
- app_info_print <AppID> - Displays all of the information the Steam servers provide about the game.
- enable/disable_license <PackageID> - This allows testing of app ownership, typically DLC.
- testappcloudpaths <AppID> - Allows testing of auto-cloud configuration before enabling auto-cloud for all customers. This command only works for one app ID at a time and needs to be run on each client that is being tested with.
- log_callbacks <first callbackID> <last callbackID> - Logs all callbacks to the console.
- log_matchmaking_callbacks <0|1> - Enables/disables logging matchmaking callbacks.
- log_ipc <counts|verbose> <filter> - See Steamworks API Logging.
Steamworks API Logging
The log_ipc command (entered into the Steam console) dumps all of the IPC calls made to the Steam client's internal interfaces. The command takes a filter param, which can be the interface you are interested in monitoring or the name of the process. Note that the names provided do not always match 1:1 with the ISteam* version, but are usually very close. Specifying "counts" or "verbose" is optional, defaulting to counts.
The default stream usually looks something like:
00000009 my_exe_name.exe:05 > IClientUser::GetSteamID( ) = [U:2:172006],
00000009 my_exe_name.exe:05 > IClientUser::BLoggedOn( ) = 1,
00000009 my_exe_name.exe:05 > IClientNetworking::IsP2PPacketAvailable( 0, ) = 0, 0,
00000009 my_exe_name.exe:05 > IClientNetworking::IsP2PPacketAvailable( 1, ) = 0, 0,
00000009 my_exe_name.exe:05 > IClientFriends::GetPersonaName( ) = "user",
00000009 my_exe_name.exe:05 > IClientUser::GetSteamID( ) = [U:2:123456],
Monitoring a specific interface
If you are trying to track a specific issue, filter the log_ipc to the specific interface.
ex:
log_ipc IClientUser
Example output:
00000009 my_exe_name.exe:05 > IClientUser::GetSteamID( ) = [U:2:172006],
00000009 my_exe_name.exe:05 > IClientUser::BLoggedOn( ) = 1,
00000009 my_exe_name.exe:05 > IClientUser::GetSteamID( ) = [U:2:123456],
IPC Report
A rollup report is available to the log_ipc command in the Steam client.
The rollup report allows you to quickly see a summary of IPC calls. The example shown below reveals that it is calling GetSteamID/BLoggedOn/GetPersonaName too often. The report is output when logging has been disabled or restarted, so to get the report below you would:
- Enter "log_ipc my_exe_name.exe"
- Wait/interact with the game to try to reproduce an issue/etc.
- Enter "log_ipc 0"
Example output:
Calls over the last 42144 milliseconds:
Process Method Calls First Last
-------------------- ---------------------------------------- ---------- ---------- -------
my_exe_name.exe IClientNetworking::IsP2PPacketAvailable 15272 9 42145
my_exe_name.exe IClientUser::GetSteamID 42652 9 42145
my_exe_name.exe IClientUser::BLoggedOn 42652 9 42145
my_exe_name.exe IClientFriends::GetPersonaName 3820 9 42145
my_exe_name.exe IClientUser::RequestEncryptedAppTicket 2 2103 2441
my_exe_name.exe IClientUtils::GetAPICallResult 2 2125 2441
my_exe_name.exe IClientUser::GetEncryptedAppTicket 1 2136 2136
IPC Log Output
The full IPC log is output to your Steam install directory:
logs\ipc_SteamClient.log