Added log rotation code