1

I've configured a seperate channel for some messages according to the cookbook:

    special:
        type:  stream
        path:  %kernel.logs_dir%/special.log
        channels: ["special"]

And getting a service to log to that is easy. But I also have $this->get('logger')->info("some info message"); statements in my controllers.

How do I teach them to log to this channel instead of the main logfile? The documentation is silent on this, only explains how to redirect services. Looking through the Logger.php didn't reveal any obvious parameter, either.

Tom
  • 2,688
  • 3
  • 29
  • 53

1 Answers1

0

I think you may use the following to create a logger from channels defined:

$logger_special = $logger->setName("special");
Stephane Gosselin
  • 9,030
  • 5
  • 42
  • 65
  • @Tom - I am cleaning up old unhelpul answers in my profile, many do this to minise noise. If this answer was not helpful let me know, if it was, kindly upvote it and / or accept it. Thanks mate. – Stephane Gosselin Feb 20 '19 at 05:07