Added log warning with exception. Replaced copy-pasted code, which fixes #2057, with function. Disabled incorrectly working code to re-establish SQL process on unexpected failure.