Chapter 15. Server Logs

Table of Contents

15.1. Introduction
15.2. Error Log
15.3. Slow Log
15.4. General Log

15.1. Introduction

The Server Logs section provides easy access to the various log files generated by the MySQL server. You can access the server's error log, slow query log, and general log using this section.

This section has one tab for each of the log files, and each tab is split into two boxes. Above the boxes, there is a bar which allows you to navigate through larger log files by breaking the log file into individual pages. Clicking in the bar will display the individual pages. The light blue area represents the portion of the log file you are currently viewing.

Figure 15.1. Displaying Entries from the Middle of the General Log

Displaying entries from the middle of the
          General Log

You can only view log files that are stored on the machine where MySQL Administrator is running, you cannot view log files on a remote machine.

Also note that some tabs may be disabled. If a tab is disabled it indicates that the log file in question has not been enabled on the MySQL server. You can enable the various log files in the Startup Variables section.

The left box (labeled Events of page x / y) displays the major events that have occurred on the current page of the log file. The right box (labeled Page Content) displays the detailed lines of the log file. By clicking on an event in the left box, the first detailed entry of the event will be highlighted in the right box.

In addition to the log file tabs, the Server Logs section has four action buttons for managing log information:

  • Open Other File will allow you to open a log file other than the currently active log file. This can be useful in situations where you rotate your log files as it allows you to open log files that have been rotated out of active use.

  • Search opens a dialog where you can specify a search term to look for in the log file. If it's found, it will be marked as selected in the right box. This command is also available by right clicking in the right box and choosing the Search ... option.

  • Save Log Page opens a dialog that allows you to specify the path and file name where the current page of the log file should be stored. By default, MySQL Administrator suggests ErrorLog.txt, SlowLog.txt, or GeneralLog.txt as a file name. Note that executing this command does not affect the actual log file in any way; it just creates a copy of the current log file contents that you may store for documenting or analyzing. This command is also available by right clicking in the right box and choosing the Save log Page ... option.

  • Refresh will reload the log files.

15.2. Error Log

Displays the MySQL server's error log. The error log file contains information indicating when the MySQL server was started and stopped and also any critical errors found when running. See The Error Log, for more information about that log file.

15.3. Slow Log

Displays the MySQL server's slow query log. If enabled (which you can do in the Startup Variables section), the MySQL server writes a log file containing all SQL commands that took more than a specific number of seconds to execute. (That number can be configured by the long-query-time variable; its default value is 10 seconds.) The time it takes to get the initial table locks is not counted as execution time. For more information about this log file, see The Slow Query Log.

15.4. General Log

Displays the MySQL server's general query log. This log can be very useful when you suspect an error in a client and want to know exactly what the MySQL server thought the client sent to it. For more information about that log file, see The General Query Log.