Class LoggerAppenderPDO
LoggerAppenderPDO appender logs to a database using the PHP's PDO extension.
Configurable parameters:
- dsn - The Data Source Name (DSN) used to connect to the database.
- user - Username used to connect to the database.
- password - Password used to connect to the database.
- table - Name of the table to which log entries are be inserted.
- insertSQL - Sets the insert statement for a logging event. Defaults to the correct one - change only if you are sure what you are doing.
- insertPattern - The conversion pattern to use in conjuction with insert SQL. Must contain the same number of comma separated conversion patterns as there are question marks in the insertSQL.
- LoggerConfigurable
- LoggerAppender
- LoggerAppenderPDO
License: Apache License, Version 2.0
Version: $Revision: 1374546 $
Since: 2.0
Link: Appender documentation
Located at appenders/LoggerAppenderPDO.php
public
|
#
activateOptions( )
Acquires a database connection based on parameters. Parses the insert pattern to create a chain of converters which will be used in forming query parameters from logging events. |
protected
|
|
public
|
|
protected
|
#
format(
Converts the logging event to a series of database parameters by using the converter chain which was set up on activation. |
public
|
|
public
PDO
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setBoolean(),
setFileSize(),
setInteger(),
setLevel(),
setNumeric(),
setPositiveInteger(),
setString()
|
protected
mixed
|
$dsn |
|
#
DSN string used to connect to the database. |
protected
mixed
|
$user |
|
#
Database user name. |
protected
mixed
|
$password |
|
#
Database password. |
protected
string
|
$insertSQL | "INSERT INTO __TABLE__ (timestamp, logger, level, message, thread, file, line) VALUES (?, ?, ?, ?, ?, ?, ?)" |
#
The insert query. |
protected
string
|
$insertPattern | "%date{Y-m-d H:i:s},%logger,%level,%message,%pid,%file,%line" |
#
A comma separated list of LoggerPatternLayout format strings which
replace the "?" in |
protected
string
|
$table | 'log4php_log' |
#
Name of the table to which to append log events. |
protected
integer
|
$reconnectAttempts | 3 |
#
The number of recconect attempts to make on failed append. |
protected
PDO
|
$db |
|
#
The PDO instance. |
protected
PDOStatement
|
$preparedInsert |
|
#
Prepared statement for the insert query. |
protected
boolean
|
$requiresLayout | false |
#
This appender does not require a layout. |
$closed,
$filter,
$layout,
$name,
$threshold
|