| **Navigation:**  SQL Drivers >====== Logging Driver I/O for debugging ====== | [[view support for aggregate functions.htm|{{btn_prev_n.gif|Previous page}}]][[coming future.htm|{{btn_home_n.gif|Return to chapter overview}}]][[sql accelerator drivers supported commands and attributes.htm|{{btn_next_n.gif|Next page}}]] | | || All of SoftVelocity's database drivers can create a log file documenting Clarion I/O statements they process, and the SQL Accelerator drivers can log the corresponding SQL statements, and the SQL return codes. You can generate system-wide logs and on-demand logs (conditional logging based on your program logic via property syntax). By default the file drivers read the **DRIVERS.INI file located in CSIDL_APPDATA\SoftVelocity\Clarion\<;clarion_version>** to get system wide tracing settings.  You can override this using either PROP:TraceFile or PROP:TraceKey. You can disable system wide logging using PROP:DriverTracing. A utility/example application is included--Trace.EXE. A compiled version is installed in the ..\bin directory and the source .APP is installed in the \Examples\Resource\Trace directory. This utility allows you to easily set tracing options for each file driver and for the VIEW engine. These setting are stored in DRIVERS.INI. **Activating Driver Logging** Clarion provides the Trace.EXE utility program, along with the source code in the Trace.App file. You can run this from the Clarion Program group located in the the Start Menu. The source code Trace.App is installed in the \Examples\DriverTrace folder. This utility allows you to activate tracing options for any FILE driver and for the View engine. These tracing options are stored in DRIVERS.INI. For system-wide logging,**// //**you can add the following to your DRIVERS.INI file: [CWdriver] Profile=[1|0] Details=[1|0] Trace=[1|0] TraceFile=[Pathname] where //driver //is the database driver name (for example [CWTopSpeed]). Neither the INI section name [//CWdriver//] nor the INI entry names are case sensitive. **Profile=1** (PROP:Profile) tells the driver to include the Clarion I/O statements in the log file; **Profile=0** tells the driver to omit Clarion I/O statements.// //The Profile switch must be turned on for the Details switch to have any effect. **Details=1** (PROP:Details) tells the driver to include record buffer contents in the log file; however, if the file is encrypted, you must turn on both the Details switch and the ALLOWDETAILS switch to log record buffer contents (see //ALLOWDETAILS//). **Details=0** tells the driver to omit record buffer contents.// //The Profile switch must be turned on for the Details switch to have any effect. **Trace=1** tells the driver to include all calls to the back-end file system, including the generated SQL statements and their return codes, in the log file. **Trace=0** omits these calls. The Trace switch generally generates log information that helps to debug the SQL drivers, but is normally not particularly useful to the developer. **TraceFile** names the log file to write to. If TraceFile is omitted the driver writes the log to //driver//.log in the current directory. **Pathname **is the full pathname or the filename of the log file to write. If no path is specified, the driver writes the specified file to the current directory. {{tipbox.jpg|TipBox.jpg}} To view the trace details in your System Debugger or Debug View, name the target trace file **'DEBUG:'** to pass profiling to OutputDebugString. Logging opens the named logfile for exclusive access. If the file exists, the new log data is appended to the file. **On Demand Logging** For on-demand logging you can use property syntax within your program to conditionally turn various levels of logging on and off. The logging is effective for the target table and any view for which the target table is the primary table. File{PROP:Profile}=FileName !Turns Clarion I/O logging ON writes to FileName File{PROP:Profile}='' !Turns Clarion I/O logging OFF File{PROP:Profile}='Debug:' !Turns Clarion I/O logging ON sends to Debug View FileName = file{PROP:Profile} !Queries the name of the log file File{PROP:Log}=string !Writes the string to the log file File{PROP:Details} =1 !Turns Record Buffer logging ON fFile{PROP:Details}=0 !Turns Record Buffer logging OFF where //Pathname //is the full pathname or the filename of the log file to create. If you do not specify a path, the driver writes the log file to the current directory. You can also accomplish on demand logging with a SEND() command and the LOGFILE driver string. See //LOGFILE //for more information. **Language Level Error Checking** You can use the FILEERROR() and FILEERRORCODE() functions to capture messages and codes returned from the backend server to the SQL Accelerator driver. See the //Language Reference// for more information on these functions. **See Also:** [[prop profile 1.htm|PROP:Profile]] , [[prop details 1.htm|PROP:Details]] , [[allowdetails.htm|ALLOWDETAILS]] , [[prop log 1.htm|PROP:LOG]] , [[prop logsql.htm|PROP:LOGSQL]]