Added log and exception log functionality. Added exception loggin in err...

...or catching.