open and close logs