Exception handling for failed casts in event handlers.
Added logging library (log4j 2).
Logger test.