Removing "HeadlessException" (4 Sonar)
Added log to error
adding logs to throwing errors