Logger Modules


Introduction

Logger modules allow the SQL Relay server programs to log various bits of information as they run. A section of the sqlrelay.conf file indicates which modules to load and what parameters to use when logging.

For example, to use the debug module, which logs detailed information for debugging purposes, you would include a section in the sqlrelay.conf file like:

<?xml version="1.0"?>
<instances>
        ...
        <instance ...>
                ...
                <loggers>
                        <logger module="debug" listener="yes" connection="yes"/>
                </loggers>
                ...
        </instance>
        ...
</instances>

The module attribute specifies which module to load. The listener and connection attributes are parameters for the module.

Different modules may have different parameters. In this case, listener="yes" tells the module to log debug info for the sqlr-listener processes and connection="yes" tells the module to log debug info for the sqlr-connection processes.

Currently, all log modules have an enabled parameter, allowing the module to be temporarily disabled. If enabled="no" is configured, then the module is disabled. If set to any other value, or omitted, then the module is enabled.

Multiple log modules may be loaded by specifying multiple logger tags.

Internally, at startup the SQL Relay server processes create instances of the specified logger modules and initializes them. Then, as they run, the call the logger modules' "run" method, passing in an event type, log level and log message. The modules then react to the different events, log levels and messages in a module-specific manner. The "debug" logger module, for example, logs every event type at every log level, while the "slowqueries" logger module only logs queries and ignores all other event types.


Available Modules

Currently, the following standard logger modules are available:

debug

The debug module logs a great deal of information to about the internal operation of the SQL Relay server to log files in the "debug directory", usually /usr/local/firstworks/var/sqlrelay/debug. It creates files named sqlr-listener."pid" and sqlr-connection."pid" where "pid" is replaced with the process id of the process that is being logged. As new processes are forked, new files are created with debug information about those processes.

This module takes three parameters: listener, connection and perms. The listener parameter may be set to "no" to disable logging of the sqlr-listener processes. The connection parameter may be set to "no" to disable logging of the sqlr-connection processes. Logging is enabled if either parameter is omitted or set to any other value. The perms parameter may be set to any ls -l style permissions string. The default is "rw-------" which translates to read/write for owner only.

The general log format is: