Logging Captured Data to File

NI Spy

Logging Captured Data to File

To save the captured NI Spy information automatically as soon as it is recorded, use file logging. If you enable file logging, the NI Spy log file is written as soon as each call is recorded. This option is useful in debugging an application that causes the system to crash before you can save current captures, because you can open the log file after restarting the system to see which call caused the error.

Note  To guarantee that the captured log file is complete during a crash, log a Spy Capture file with Write to file as soon as possible selected.

To enable NI Spy file logging, follow these steps:

  1. Select Spy»Options when capture is stopped.
  2. In the File Logging box, check the Log to File checkbox.

    In the edit box, either type the path and name for the log file, or use the Browse button to select a location for the NI Spy log file.
  3. Select the type of file to log.

    For most applications, a Spy Capture file is the best option. A Spy Capture file is a binary format that is the quickest to create, and it can be logged in a fail-safe manner if you select Write to file as soon as possible. Only NI Spy can open and display Spy Capture files, but you can export them to other formats after logging is completed.

    If other applications need the log output while NI Spy is logging, log to a plain text file or comma-separated variable (CSV) file. These files are slower to create and lack much of the information stored in a Spy Capture file. But they are logged during NI Spy operation, and other applications processing the output can use them. However, NI Spy cannot load these files.
  4. Select the method of file logging.

    If you select Allow NI Spy to schedule writing (the default), the log file is written with each recorded API call and closed only when capture is stopped. This method of file logging is more efficient than selecting Write to file as soon as possible, but may not be secure during system crashes. Consequently, you should use this option only if the problem you are trying to debug does not cause a system crash.

    If you select Write to file as soon as possible, the log file is opened, written, and flushed with each recorded API call. When logging to a Spy Capture file, this method of file logging is secure during system crashes, but is somewhat slow because of the overhead caused by repeatedly opening and closing the log file.
Note  Using file logging is likely to slow down all applications. In addition, if you are low on disk space, choosing this option could cause you to run out of disk space. To turn off file logging, uncheck the Log to File checkbox.