Better log

Added better exception management and detailed debug log info