refactory log rotate