refine the monitor code & add log txt