

TITLE
Fix example logs repeating themselves

COMMENTS
1

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
# Fix Loggers repeating themselves during the Examples tests

## What does this add?

This PR refactores slighly how the `stream_handler` is made and passed to `logger` during all of the examples tests

## Why is it needed?

When running the `no_trainer` tests, I was noticing that after each test was called the data would repeat itself. So after test 1 it was only logged once, test 2 twice, etc. 

For example something like the following was printed:
```
***** Running training *****
***** Running training *****
***** Running training *****
  Num examples = 10
  Num examples = 10
  Num examples = 10
```
After further investigation, I found that this was due to the `stream_handler` being added at the start of each test. As discussed in this [SO post I found](https://stackoverflow.com/questions/6729268/log-messages-appearing-twice-with-python-logging), since the loggers are global we keep adding more handlers without actually removing them. 

As a result we kept getting multitudes of sys.stdout loggers being added, leading to these multiple print statements each time. 

The fix is before each test case is written, add in our handler (e.g.):
```python
stream_handler = logging.StreamHandler(sys.stdout)
logger.addHandler(stream_handler)

class SomeTestCase(TestCasePlus):
  ...
```

Also unsure why this didn't quite happen during CircleCI, but this was what occurred locally for me