Better logging management

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