add the part of saving log