Fix log messages in try-catch blocks

Some log statements swallowed exceptions and stacktraces in `catch` blocks.