Expand exception stack trace in log in debug mode

Log exception stack trace in debug mode instead of just the message.

Based on the discussion in https://github.com/owncloud/core/pull/5273

Please review @karlitschek @DeepDiver1975 @tanghus