Perforce Server Trace Flags
SUMMARY
This article describes the uses of server trace flags, the various configurations of the flags, and their individual outputs.
DETAILS
To turn on command tracing in the Perforce Server, add the -v server=1, -v server=2, or -v server=3 (highest level) flag to the p4d startup command. Use P4LOG or the -L flag to name a log file. For example:
p4d -r /usr/perforce -v server=3 -p 1666 -L /usr/perforce/log
Or on Windows, enter the P4DEBUG variable and restart Perforce. For example:
p4 set -S Perforce P4DEBUG=server=3
Trace output appears in the log file, and shows the date, time, username, IP address, and command for each request the server processes.
As of 2005.2, the server automatically produces diagnostic output to help identify performance problems. The new support is on by default but can be turned off or adjusted with the -vtrack=x flag to the server. Any user commands that exceed certain thresholds for resource usage (CPU, lapse time, database I/O, network I/O, among other things) automatically get logged into the server error log P4LOG. The levels that can be set with -vtrack=x are:
- 0 turn off tracking
- 1 track all commands
- 2 track excess usage for a server < 10 users
- 3 track excess usage for a server < 100 users
- 4 track excess usage for a server < 1000 users
- 5 track excess usage for a server > 1000 users
If -vtrack is not provided on the server command line or set with P4DEBUG, the tracking level is computed from the number of users listed in the server license file.
As of 2001.1, support has been added for -v server=2 and -v server=3.
- -v server=1 ensures that the start information for each command is logged.
- -v server=2 extends server tracing to include command start and stop.
- -v server=3 adds a "compute end" message for certain commands.
Prior to 98.1, you could not set this trace flag when you started p4d.exe as a service on Windows. You could only start p4d.exe from the command line on Windows when setting this flag.
As of 98.1 and later, you can set P4DEBUG as a registry variable to server=1 (use p4 set), so you can use this trace flag even with Perforce installed as a service on Windows.
Prior to 97.3, this feature was not available.
