fixed the logging and file rotation part