using atexit to store the log file