Fix and improve logging configuration