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 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
|
'mongodb://' |
#
Default prefix for the |
string |
DEFAULT_MONGO_HOST
|
'localhost' |
#
Default value for |
integer |
DEFAULT_MONGO_PORT
|
27017 |
#
Default value for |
string |
DEFAULT_DB_NAME
|
'log4php_mongodb' |
#
Default value for |
string |
DEFAULT_COLLECTION_NAME
|
'logs' |
#
Default value for |
integer |
DEFAULT_TIMEOUT_VALUE
|
3000 |
#
Default value for |
protected
mixed
|
$host |
|
#
Server on which mongodb instance is located. |
protected
mixed
|
$port |
|
#
Port on which the instance is bound. |
protected
mixed
|
$databaseName |
|
#
Name of the database to which to log. |
protected
mixed
|
$collectionName |
|
#
Name of the collection within the given database. |
protected
mixed
|
$userName |
|
#
Username used to connect to the database. |
protected
mixed
|
$password |
|
#
Password used to connect to the database. |
protected
mixed
|
$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
|