Symptoms

How do I enable/disable debug logging in * Plesk 11.5 * and up under Linux?

Resolution

  1. First you should copy sample config /usr/local/psa/admin/conf/panel.ini.sample to /usr/local/psa/admin/conf/panel.ini, unless panel.ini already exists there:

    # ll /usr/local/psa/admin/conf/ | grep panel
    -rw-r--r-- 1 root root     317 Feb  6 11:39 panel.ini
    -rw-r--r-- 1 root root     198 Oct 15 16:01 panel.ini.original
    -rw-r--r-- 1 root root    1542 Dec 10 17:06 panel.ini.sample
    
  2. To enable debug logging, you should uncomment (remove ; semicolon at the start of the string) following lines in panel.ini:

    [debug]
    ; Enable debug mode (do not use in production environment)
    enabled = on
    [log]
    ; Log messages verbosity level (from 0 to 7)
    ; 0 - only critical errors, 7 - all including debug messages, default - 3
    filter.priority = 7
    ; Enable logging of SQL queries
    show.sql_query = on
    ; Enable logging of external utilities calls
    show.util_exec = on
    
  3. To disable debug logging you should comment the above lines in panel.ini.

  4. Log with enabled debug mode can be found in /usr/local/psa/admin/logs/panel.log file.

This works for pretty much any Plesk executable, including small binaries.

Example:

    # /usr/local/psa/bin/ip_ban --update -ban_period 600 -ban_time_window 600 -max_retries 10
    DEBUG [dbquery] [0] SQL: SET sql_mode = ''
    DEBUG [dbquery] [0] END: 0.00023102760314941 sec
    DEBUG [dbquery] [1] SQL: SET NAMES utf8
    DEBUG [dbquery] [1] END: 0.00013208389282227 sec
    DEBUG [dbquery] [2] SQL: connect
    DEBUG [dbquery] [2] END: 0.00038313865661621 sec
    DEBUG [dbquery] [3] SQL: SET sql_mode = ''
    DEBUG [dbquery] [3] END: 0.00014400482177734 sec
    ...
    SUCCESS: The settings were updated.

To suppress DEBUG messages from this binary, we comment out (add ; semicolon at the start of the string) filter.priority = 7 in panel.ini.

Output will then look like this:

# /usr/local/psa/bin/ip_ban --update -ban_period 600 -ban_time_window 600 -max_retries 10
SUCCESS: The settings were updated.

Changes take effect immediately (e.g. there is no need for service psa restart or other such commands), because small binaries like ip_ban read those settings each time they are started.

There are also other options which will allow you to hide some of the log messages. Among them are:

    ; Enable logging of SQL queries
    show.sql_query = on

    ; Enable logging of external utilities calls
    show.util_exec = on

    ; Enable logging of stdin and stdout for external utilities calls (do not use in production environment)
    show.util_exec_io = on

Internal content