making the use of the log file optional - use stdout if not specified