fix StringIO errors in unit test

alarm tests are throwing StringIO failures as it's being closed to soon.
change the way we capture logging.

Change-Id: Ifd956b8fe144219d029f8afb369ec25d13177078
Closes-Bug: #1329692
Merge "fix StringIO errors in unit test"