Class LoggerAppenderMongoDB
Appender for writing to MongoDB.
This class was originally contributed by Vladimir Gorej.
Configurable parameters:
- host - Server on which mongodb instance is located.
- port - Port on which the instance is bound.
- databaseName - Name of the database to which to log.
- collectionName - Name of the target collection within the given database.
- username - Username used to connect to the database.
- password - Password used to connect to the database.
- timeout - For how long the driver should try to connect to the database (in milliseconds).
- LoggerConfigurable
- LoggerAppender
- LoggerAppenderMongoDB
License: Apache License, Version 2.0
Version: $Revision: 1346363 $
Since: 2.1
Link: Appender documentation
Link: Vladimir Gorej's original submission.
Link: MongoDB website.
Located at core/log4php/appenders/LoggerAppenderMongoDB.php
public
|
|
public
|
#
activateOptions( )
Setup db connection.
Based on defined options, this method connects to the database and
creates a |
public
|
|
protected
array
|
#
format(
Converts the logging event into an array which can be logged to mongodb. |
protected
array
|
#
formatThrowable( Exception $ex )
Converts an Exception into an array which can be logged to mongodb. |
public
|
|
public
|
|
public
string
|
|
public
|
|
public
integer
|
|
public
|
#
setDatabaseName( string $databaseName )
Sets the value of |
public
string
|
|
public
|
#
setCollectionName( string $collectionName )
Sets the value of |
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
integer
|
|
public
Mongo
|
|
public
MongoCollection
|
setBoolean(),
setFileSize(),
setInteger(),
setLevel(),
setNumeric(),
setPositiveInteger(),
setString()
|
string |
DEFAULT_MONGO_URL_PREFIX
Default prefix for the |
#
'mongodb://'
|
string |
DEFAULT_MONGO_HOST
Default value for |
#
'localhost'
|
integer |
DEFAULT_MONGO_PORT
Default value for |
#
27017
|
string |
DEFAULT_DB_NAME
Default value for |
#
'log4php_mongodb'
|
string |
DEFAULT_COLLECTION_NAME
Default value for |
#
'logs'
|
integer |
DEFAULT_TIMEOUT_VALUE
Default value for |
#
3000
|
protected
|
$host
Server on which mongodb instance is located. |
|
protected
|
$port
Port on which the instance is bound. |
|
protected
|
$databaseName
Name of the database to which to log. |
|
protected
|
$collectionName
Name of the collection within the given database. |
|
protected
|
$userName
Username used to connect to the database. |
|
protected
|
$password
Password used to connect to the database. |
|
protected
|
$timeout
Timeout value used when connecting to the database (in milliseconds). |
|
protected
Mongo
|
$connection
Connection to the MongoDB instance. |
|
protected
MongoCollection
|
$collection
The collection to which log is written. |
$closed,
$filter,
$layout,
$name,
$requiresLayout,
$threshold
|