eZ Components - EventLogDatabaseTiein ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. contents:: Table of Contents Introduction ============ The EventLogDatabaseTiein component provides an API to log events and audit trails using a database connection. See the EventLog_ and Database_ tutorials for more information about the components that EventLogDatabaseTiein interacts with. ezcLogDatabaseWriter is the log writer that writes log messages to the database. To write log messages to the database, the Database_ component is used. The table to which the log is written should already exist. Class overview ============== ezcLogDatabaseWriter is the only class in EventLogDatabaseTiein: ezcLogDatabaseWriter The ezcLogDatabaseWriter class writes the log message to a database. For more information, see the class documentation. Examples ======== Writing to a database --------------------- In this example, a MySQL database is used for writing log messages. The database "app" and the table "log" should already exist. The table should at least contain the following columns: time, message, severity, source and category. .. include:: tutorial_database.php :literal: An example SQL query to create the table is as follows:: CREATE TABLE log ( category varchar(255) NOT NULL, file varchar(255), id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, line bigint, message varchar(255) NOT NULL, severity varchar(255) NOT NULL, source varchar(255) NOT NULL, time timestamp NOT NULL ); The log table will have rows similar to the following:: array(16) { ["category"]=> string(6) "Design" [0]=> string(6) "Design" ["file"]=> NULL [1]=> NULL ["id"]=> string(1) "1" [2]=> string(1) "1" ["line"]=> NULL [3]=> NULL ["message"]=> string(41) "File '/images/spacer.gif' does not exist." [4]=> string(41) "File '/images/spacer.gif' does not exist." ["severity"]=> string(7) "Warning" [5]=> string(7) "Warning" ["source"]=> string(11) "Application" [6]=> string(11) "Application" ["time"]=> string(19) "2006-11-28 14:21:32" [7]=> string(19) "2006-11-28 14:21:32" } .. _EventLog: http://ez.no/doc/components/view/trunk/(file)/introduction_EventLog.html .. _Database: http://ez.no/doc/components/view/trunk/(file)/introduction_Database.html .. Local Variables: mode: rst fill-column: 79 End: vim: et syn=rst tw=79