services:
my_logger:
class: Monolog\Logger
arguments: [my_info]
calls:
- [pushHandler, [@my_log_handler]]
my_log_handler:
class: Monolog\Handler\StreamHandler
arguments: [%kernel.root_dir%/logs/my_info.log, 100]
Usage (in
Controller
, for example):$this->get('my_logger')->info('info message');
评论
发表评论