Skip to content
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

Merged
merged 9 commits into from Sep 5, 2018
Merged

Conversation

diosmosis
Copy link
Member

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.

@diosmosis diosmosis added the Needs Review PRs that need a code review label Aug 22, 2018
@diosmosis diosmosis added this to the 3.7.0 milestone Aug 22, 2018
@@ -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;
Copy link
Member

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?

Copy link
Member Author

@diosmosis diosmosis Aug 22, 2018

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

@diosmosis
Copy link
Member Author

Updated

@tsteur
Copy link
Member

tsteur commented Aug 23, 2018

Haven't tested but looks good 👍

@tsteur
Copy link
Member

tsteur commented Sep 1, 2018

Should be good to merge if tests pass 👍

@mattab mattab modified the milestones: 3.7.0, 3.6.1 Sep 1, 2018
@diosmosis diosmosis merged commit d679c55 into 3.x-dev Sep 5, 2018
@diosmosis diosmosis deleted the logs-in-tests branch September 5, 2018 22:33
InfinityVoid pushed a commit to InfinityVoid/matomo that referenced this pull request Oct 11, 2018
* 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.
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants