string foreach logging file pipe