cann / yii2-redis-log
redis log extension of yii2
Installs: 1 286
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.10
- yiisoft/yii2-redis: ^2.0
README
Redis Logger Of Yii2
安装
composer require cann/yii2-redis-log
配置
// ***
'components' => [
'log' => [
'targets' => [
'redis' => [
'class' => 'cann\yii\log\RedisTarget',
'redis' => 'redis',
'key' => 'default',
'levels' => ['trace', 'info'],
'categories' => ['yii\*'],
]
]
],
]
key
用于区分不同的Redis队列
将redis中的日志落地至数据库
如果要将 key
为default
的Redis Log导入数据库:
yii log-handler/export-to-db default
如果要将所有Redis Log导入数据库:
yii log-handler/export-all-to-db
你可以将该命令写入crontab定期执行
log handler会自动创建log表,表名默认为 {db prefix}_log_{key}