Add LogManagerTest.
Fix cleanup bug discovered by LogManagerTest.

I love tested software. :)