modified to print log