Add debug logging and inherit stdio