The Log reports progress and results when executing in the SQL Commander, Import, Export Schema/Database, Procedure Editor, and when running Database Object Actions. The appearance of the Log may differ slightly depending on which of these functions is used. The Log was completely redesigned in 10.0 and now saves unlimited number of log entries to file. Due to memory constraints, the Log grid in the DbVisualizer tool keeps up to 10 000 entries until it starts truncating the oldest entries.
Note that the detail level in a log entry message depends on the driver and database that is being used. Some databases are very good at telling you what went wrong and why, while others provide less detail.
The preprocessing step is performed just before a script is executed. It locates any variables, parameters, and restricted commands (defined in the Permissions category in Tools->Tool Properties) in the script. Depending how large the script is, preprocessing may take some time to complete and DbVisualizer may even advise you to run without preprocessing if the script is too large.
Check Executing an External Script page for more information.
Disabled functionality during execution
When a script is executed some functions in the Log are disabled:
- Quick Search
- Expand row heights (double-click)
- Hyperlinks to highlight errors and statements
- Save Log to Text File
While executing there is progress information in the Log status bar showing overall metrics for the execution. It helps getting a quick overview of number of failed and successful statements, elapsed time, and number of statements executed per time unit.
The progress bar shows how much of the script has been executed. The progress bar switch to an indeterminate mode when Preprocess Script is switched off or when running a script using the @run client-side command. The reason is that the Log then doesn't count how many statements to execute.
When new log entries are added the Log grid is automatically scrolled to the bottom. This can be turned off in the toolbar or by right-click in the grid, and select Auto Scroll.
Auto Clear log
Having auto clear checked, the log is cleared when execution is started. Disabling auto clear will keep all entries until number of entries exceeds 10 000 when truncation is triggered.
When the number of entries in the grid exceeds 10 000 the log is truncated by removing the oldest entries. When the log is truncated an icon and "Truncated" text is displayed in the grid status bar. If having auto clear log disabled, you will still see the STARTED and FINISHED entries for a previous executions in the grid along with an entry telling how many log entries has been truncated for that execution.
Auto resize row heights
The Message and SQL/Command columns may include multi-lined content. During execution only a single line of content is displayed in the grid. Once the execution has completed, and there are any FAILED statements these rows automatically expands to show all of its content. In the right-click menu under Auto Resize Row Heights, the auto resizing may be configured to also expand SUCCESS entries.
A cell having multi-lined content ends with three dots, "...". To manually expand/collapse a row with more content, double-click the row.
Navigating to next/previous failed log entry
To navigate to next/previous failed statement, use the Goto Next Failed and Goto Previous Failed actions in the right-click menu. An alternative is to filter out all but FAILED log entries in the grid, see Filter and search section below for more information.
Highlight statement or error in the SQL editor
If there is an editor associated with the log grid, such as the SQL Commander, the Command column for all log entries is represented by a hyperlink. Clicking the link will navigate to, and highlight the corresponding SQL/command in the SQL editor.
The same applies for any FAILED statements whereas the Status column is then a hyperlink, when clicked it will show the statement that failed. Depending on if the database reports error positions, clicking the link will set the caret at the position where the error started.
If a single statement produces multiple errors, clicking on the FAILED status link, will then show a menu with all errors. Selecting an error highlights it in the SQL editor.
For @run commands, clicking the @run link in the Command column shows a menu in which you can select to load the related file in a new SQL Commander tab.
The matching actions are in the right-click menu, Highlight Statement and Highlight Failed Statement.
Saving all Log entries to text file
All log entries are written to file, even those that has been truncated in the Log grid. The Save Log to Text File right-click menu action saves this log to text. Note that the log file is cleared between executions if auto clear log is enabled and when manually clearing the log. It is also removed when closing down the SQL Commander tab.
The internal log file is stored in json format under the $HOME/.dbvis/sqllogs folder with the .dson extension. A log file may be loaded in the Log grid using Load Log File in the right-click menu.
Copy Log Entries to clipboard
The copy log entries to clipboard actions transforms the selected rows to text format and puts these on the system clipboard. This is useful if you want to share all or some log entries with others. The difference with the standard Copy Selection is that the latter copies only the selected cells in standard grid copy format typically separated with tabs.
Copy executed SQLs to the SQL Commander
The SQLs displayed in the log may be copied as a script to an existing or a new SQL Commander. Just select the rows you want to copy and then right-click and Load Selected Commands into Editor.
Filter and search
The filtering capability is useful to quickly limit what entries are displayed in the grid. A good example is to click the filtering icon in the Status column header and then de-select all statuses than FAILED (or just double-click FAILED to de-select the others). The result is that only FAILED statements are displayed in the log grid. That type of filtering can be applied to any on the columns (and in fact in most grids in DbVisualizer). The quick search field can be used to further refine to do full text search on all entries in the grid.
There is also a (Custom...) option that let you define your own condition to be used in the filter.
Applying a column filter will not have any effect on the STARTED or any @run log entries as these are grouping (indented) entries in the Log grid.
Configure the Log
The Time column in the log shows by default hour:minute:second (HH:mm:ss) but can be configured to show date, milliseconds, and more. Change this in Tools->Tool Properties and the General / SQL Commander / SQL Log category.