Fix logging issues when file is big