Add test for logger
Fix output duplication when stdout is redirected