Better error and logging management

This is the companion PR to https://github.com/gem/oq-engine/pull/1370. Notice that is *essential* to set DEBUG=False if we want to see the errors in the log.