Make log level changeable at run time

Copied the patch suggested by Luc Simard on Google Groups
Added a unit test for changing the log level at run time. Minor tweak to use a const_iterator
Fixed a Release only crash. Happened only out of Visual Studio, in release mode