use*_*420 2 php symfony monolog
在config.yml中可以有类似的东西吗?
monolog:
handlers:
hand1:
type: stream
path: "%kernel.root_dir%/logs/symfony1.log"
level: info
hand2:
type: stream
path: "%kernel.root_dir%/logs/symfony2.log"
action_level: info
Run Code Online (Sandbox Code Playgroud)
如何在每个时刻或每个控制器中选择哪个处理程序或在哪个文件中可以编写日志?
谢谢
gri*_*eau 11
你可以使用频道(Monolog 2.4+)
在config.yml中:
monolog:
channels: [channel1, channel2]
handlers:
main:
type: stream
path: %kernel.logs_dir%/%kernel.environment%.log
level: debug
channel1:
type: stream
path: %kernel.logs_dir%/channel1.log
channels: [channel1]
Run Code Online (Sandbox Code Playgroud)
在控制器中:
$this->get('monolog.logger.channel1')->info("...");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1857 次 |
| 最近记录: |