The problem of blocked terminal is solved by adding vTaskDelete call at the end of the task function. And I also improved the logger task function in the same way. Now the logger can output to syslog file.