Class yii\mongodb\log\MongoDbTarget
Inheritance | yii\mongodb\log\MongoDbTarget » yii\log\Target |
---|---|
Available since version | 2.0 |
MongoDbTarget stores log messages in a MongoDB collection.
By default, MongoDbTarget stores the log messages in a MongoDB collection named 'log'. The collection can be changed by setting the $logCollection property.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$db | yii\mongodb\Connection|string | The MongoDB connection object or the application component ID of the MongoDB connection. | yii\mongodb\log\MongoDbTarget |
$logCollection | string|array | The name of the MongoDB collection that stores the session data. | yii\mongodb\log\MongoDbTarget |
Public Methods
Method | Description | Defined By |
---|---|---|
export() | Stores log messages to MongoDB collection. | yii\mongodb\log\MongoDbTarget |
init() | Initializes the MongoDbTarget component. | yii\mongodb\log\MongoDbTarget |
Property Details
The MongoDB connection object or the application component ID of the MongoDB connection. After the MongoDbTarget object is created, if you want to change this property, you should only assign it with a MongoDB connection object.
The name of the MongoDB collection that stores the session data. Please refer to yii\mongodb\Connection::getCollection() on how to specify this parameter. This collection is better to be pre-created with fields 'id' and 'expire' indexed.