I have a Symfony2 Console application with a few commands:
$application = new Application();
$application->add(new MyCommand1());
$application->add(new MyCommand2());
$application->run();
When running the application, I'd like the output to be redirected both to the console and to a file.
I can use StreamOutput for this, but it looks like I can only provide such an output object if I manually run one of the commands:
$input = ...;
$output = new StreamOutput(fopen('output.log', 'a'));
$command = new MyCommand1();
$command->run($input, $output);
But this is not what I want.
Is it possible to add a secondary output to the Application itself? So that all commands output both to the console, and to a file.