PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TDbLogRoute

TDbLogRoute class

TDbLogRoute stores log messages in a database table. To specify the database table, set setConnectionID ConnectionID to be the ID of a TDataSourceConfig module and setLogTableName LogTableName. If they are not setting, an SQLite3 database named 'sqlite3.log' will be created and used under the runtime directory.

By default, the database table name is 'pradolog'. It has the following structure:

CREATE TABLE pradolog
 (
        log_id INTEGER NOT NULL PRIMARY KEY,
        level INTEGER,
        category VARCHAR(128),
        logtime VARCHAR(20),
        message VARCHAR(255)
  );
TComponent
Extended by TApplicationComponent
Extended by TLogRoute
Extended by TDbLogRoute
Package: System\Util
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.1.2
Located at Util/TLogRouter.php
Methods summary
public
# __destruct( )

Destructor. Disconnect the db connection.

Destructor. Disconnect the db connection.

Overrides

TComponent::__destruct()
public
# init( TXmlElement $config )

Initializes this module. This method is required by the IModule interface. It initializes the database for logging purpose.

Initializes this module. This method is required by the IModule interface. It initializes the database for logging purpose.

Parameters

$config
TXmlElement
configuration for this module, can be null

Throws

TConfigurationException
if the DB table does not exist.

Overrides

TLogRoute::init()
protected
# processLogs( array $logs )

Stores log messages into database.

Stores log messages into database.

Parameters

$logs
array
list of log messages
protected
# createDbTable( )

Creates the DB table for storing log messages.

Creates the DB table for storing log messages.

Todo

create sequence for PostgreSQL
protected TDbConnection
# createDbConnection( )

Creates the DB connection.

Creates the DB connection.

Returns

TDbConnection
the created DB connection

Throws

TConfigurationException
if module ID is invalid or empty
public TDbConnection
# getDbConnection( )

Returns

TDbConnection
the DB connection instance
public string
# getConnectionID( )

Returns

string
the ID of a TDataSourceConfig module. Defaults to empty string, meaning not set.
public
# setConnectionID( string $value )

Sets the ID of a TDataSourceConfig module. The datasource module will be used to establish the DB connection for this log route.

Sets the ID of a TDataSourceConfig module. The datasource module will be used to establish the DB connection for this log route.

Parameters

$value
string
ID of the TDataSourceConfig module
public string
# getLogTableName( )

Returns

string
the name of the DB table to store log content. Defaults to 'pradolog'.

See

TDbLogRoute::setAutoCreateLogTable()
public
# setLogTableName( string $value )

Sets the name of the DB table to store log content. Note, if setAutoCreateLogTable 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: (key CHAR(128) PRIMARY KEY, value BLOB, expire INT)

Sets the name of the DB table to store log content. Note, if setAutoCreateLogTable 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: (key CHAR(128) PRIMARY KEY, value BLOB, expire INT)

Parameters

$value
string
the name of the DB table to store log content

See

TDbLogRoute::setAutoCreateLogTable()
public boolean
# getAutoCreateLogTable( )

Returns

boolean
whether the log DB table should be automatically created if not exists. Defaults to true.

See

TDbLogRoute::setAutoCreateLogTable()
public
# setAutoCreateLogTable( boolean $value )

Parameters

$value
boolean
whether the log DB table should be automatically created if not exists.

See

TDbLogRoute::setLogTableName()
Methods inherited from TLogRoute
collectLogs(), formatLogMessage(), getCategories(), getLevelName(), getLevelValue(), getLevels(), setCategories(), setLevels()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __construct(), __get(), __isset(), __set(), __sleep(), __unset(), __wakeup(), addParsedObject(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Properties inherited from TLogRoute
$_levelNames, $_levelValues
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO