New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add [tests] config option to enable logging in tests. #13335
Conversation
config/environment/test.php
Outdated
@@ -8,7 +8,14 @@ | |||
return array( | |||
|
|||
// Disable logging | |||
'Psr\Log\LoggerInterface' => DI\object('Psr\Log\NullLogger'), | |||
'Psr\Log\LoggerInterface' => \DI\decorate(function ($previous, ContainerInterface $c) { | |||
$enableLogging = $c->get('ini.tests.enable_logging') == 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to log only to file? I wonder if logging to stdout/print whether it would fail eg some system tests because the logging output would maybe appear there? (not sure....)
What could be useful as well is a command line option for tests:run
but not sure if that makes things too complicated (be faster to just add -vvv
) or something to the command than enabling it. Not needed though.
All good for this PR but would maybe check if logging to file only is possible? (or maybe doesn't make sense).
Can you add a developer changelog entry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think both requests are doable... Will do the following:
- during tests only log to file
- set the ini config in tests:run if command line option given (I think it's useful having a separate option since -vvv will also print a lot of stuff to the screen)
- add to developer changelog
…l runs + during tests only log to file.
Updated |
Haven't tested but looks good 👍 |
Should be good to merge if tests pass 👍 |
* Add [tests] config option to enable logging in tests. * Allow tests:run/tests:run-ui commands to enable logging for individual runs + during tests only log to file. * Remove Fixture field * fix failing test * fixing build * Fix another failure. * Fix an other test.
Found it useful sometimes to enable logging when debugging strange test failures. Personally prefer to have it enabled all the time which can be done w/ an INI config option.