add logging
TODO: multiple process and multiple thread while logging well