To turn on command tracing in the Helix 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, or OSX use p4 set to create the P4DEBUG variable and restart the Helix Server. 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.
To enable both, "server" and "track" flags at the same time, you can just do the following:
p4 set -S Perforce P4DEBUG="track=1 server=3"
As of 2001.1, support has been added for -v server=2 and -v server=3. 2011.1 adds -v server=4.
- -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.
- -v server=4 adds errors sent to the client to the server log.
Please note, a Helix Server might log stop information for commands at -v server=1
if the command is long running. This differs from -v server=2
, which ensures that the stop information is logged for all commands regardless of how long they take to complete.
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 the Helix Server installed as a service on Windows.
Prior to 97.3, this feature was not available.
- p4 set only works on Windows or OSX operating systems. It will not work with Cygwin. Either use p4d command line options, or environment variables elsewhere.