Improve logging (prevent duplicate handlers)