Class CDbLogRoute
CDbLogRoute stores log messages in a database table.
To specify the database table for storing log messages, set CDbLogRoute::$logTableName
as the name of the table and specify CDbLogRoute::$connectionID
to be
the ID of a CDbConnection
application component. If they are not set, a
SQLite3 database named 'log-YiiVersion.db' will be created and used under the
application runtime directory.
-
CComponent
-
CLogRoute
-
CDbLogRoute
Methods summary
public
|
#
init( )
Initializes the route. This method is invoked after the route is created by
the route manager.
Initializes the route. This method is invoked after the route is created by
the route manager.
Overrides
|
protected
|
#
createLogTable( CDbConnection $db, string $tableName )
Creates the DB table for storing log messages.
Creates the DB table for storing log messages.
Parameters
- $db
CDbConnection
$db the database connection
- $tableName
string $tableName the name of the table to be created
|
protected
CDbConnection
|
|
protected
|
#
processLogs( array $logs )
Stores log messages into database.
Stores log messages into database.
Parameters
- $logs
array $logs list of log messages
|
Methods inherited from CComponent
__call(),
__get(),
__isset(),
__set(),
__unset(),
asa(),
attachBehavior(),
attachBehaviors(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
detachBehavior(),
detachBehaviors(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
getEventHandlers(),
hasEvent(),
hasEventHandler(),
hasProperty(),
raiseEvent()
|
Properties summary
public
string
|
$connectionID
|
|
#
the ID of CDbConnection application component. If not set, a SQLite database
will be automatically created and used. The SQLite database file is
<span class="php-keyword1">protected</span>/runtime/<span
class="php-keyword2">log</span>-YiiVersion.db .
the ID of CDbConnection application component. If not set, a SQLite database
will be automatically created and used. The SQLite database file is
<span class="php-keyword1">protected</span>/runtime/<span
class="php-keyword2">log</span>-YiiVersion.db .
|
public
string
|
$logTableName
|
'YiiLog' |
#
the name of the DB table that stores log content. Defaults to 'YiiLog'. If
CDbLogRoute::$autoCreateLogTable is false and you want to create the DB table manually
by yourself, you need to make sure the DB table is of the following
structure:
(
id INTEGER NOT NULL PRIMARY KEY,
level VARCHAR(128),
category VARCHAR(128),
logtime INTEGER,
message TEXT
)
Note, the 'id' column must be created as an auto-incremental column. In
MySQL, this means it should be id INTEGER NOT <span
class="php-keyword1">NULL</span> AUTO_INCREMENT PRIMARY <span
class="php-keyword2">KEY</span> ; In PostgreSQL, it is id
SERIAL PRIMARY <span class="php-keyword2">KEY</span> .
the name of the DB table that stores log content. Defaults to 'YiiLog'. If
CDbLogRoute::$autoCreateLogTable is false and you want to create the DB table manually
by yourself, you need to make sure the DB table is of the following
structure:
(
id INTEGER NOT NULL PRIMARY KEY,
level VARCHAR(128),
category VARCHAR(128),
logtime INTEGER,
message TEXT
)
Note, the 'id' column must be created as an auto-incremental column. In
MySQL, this means it should be id INTEGER NOT <span
class="php-keyword1">NULL</span> AUTO_INCREMENT PRIMARY <span
class="php-keyword2">KEY</span> ; In PostgreSQL, it is id
SERIAL PRIMARY <span class="php-keyword2">KEY</span> .
See
|
public
boolean
|
$autoCreateLogTable
|
true |
#
whether the log DB table should be automatically created if not exists.
Defaults to true.
whether the log DB table should be automatically created if not exists.
Defaults to true.
See
|