added flush() to the test script for real-time logs