3.23. <Log SQL> Previous topic Parent topic Child topic Next topic

This optional clause creates an SQL logger, which will log all messages with a priority level of Trace or more to an SQL database. The logging is in addition to any logging to the file defined by LogFile. For more information, see Section 3.7.13. LogFile. This clause supports all the common SQL configuration parameters. For more information about the SQL configuration parameters, see Section 3.8. SQL configuration.
The messages are inserted with the following SQL statement:
insert into tablename (TIME_STAMP, PRIORITY, MESSAGE) 
            values (time, priority, 'message')
You must create a table to insert into before you can use this clause. There are example logging tables created in the example SQL files in the goodies/ directory of the Radiator distribution.
The logger becomes active when it is encountered in the configuration file. It will log parse errors from later in the configuration file and subsequent run-time events. Parse errors from earlier in the configuration file will not be logged through this clause.
You can place a <Log xxxxxx> clause inside any clause in the configuration file. This will cause messages originating from within that clauses code to be logged with the logger prior to being logged with any global loggers. This can be handy for debugging or tracing only certain Realms or AuthBy clauses:
      # This will log messages from within the Handler
      <Log SQL>
            #Trace 2
            DBSource dbi:.......
It is good practice to use a different DBSource than for other SQL clauses in your configuration file. This allows SQL errors on DBSource to be logged.