Added LoggingHandler and unit test. With thanks to Benjamin Muschko.