Keeping a Log File in Visual Studio

The Windows Debugger can write a log file that records the debugging session. This log file contains all of the commands that you type and the responses from the debugger. In Microsoft Visual Studio, you can open, append, and close log files by entering commands in the Debugger Immediate Window.

The procedures shown in this topic require that you have the Windows Driver Kit integrated into Visual Studio. To get the integrated environment, first install Visual Studio, and then install the Windows Driver Kit (WDK). For more information, see Windows Driver Development.

If the Debugger Immediate Window is not already open, from the Debug menu, choose Windows>Immediate.

Opening a New Log File

To open a new log file, enter the .logopen (Open Log File) command. If you use the /t option, the date and time are appended to your specified file name. If you use the /u option, the log file is written in Unicode instead of in ASCII.

Appending to an Existing Log File

To append text to an existing log file, enter the .logappend (Append Log File) command. If you are appending to a Unicode log file, you must use the /u option.

Closing a Log File

To close an open log file, enter the .logclose (Close Log File) command.

Checking Log File Status

To determine the log file status, enter the .logfile (Display Log File Status) command.

Send comments about this topic to Microsoft