Better management of BAD REQUEST and INTERNAL SERVER ERROR response
Log the debug and trace messages only if the Logger is set on debug or trace level