The pipe (8) documentation explains why this happens:
argv = command ... (required)
The command to be executed. This should be indicated as the last attribute of the command. The command is executed directly, that is, without interpreting shell metacharacters by the shell command of the translator.
Lack of shell interpretation means that redirection will not work. Instead, >>they /tmp/test.logsimply end as additional arguments for echo.
According to the documentation, Postfix> = 3.0 allows quoting spaces in arguments using "{" and "}", so the following should work:
argv=/bin/sh -c { echo foo >> /tmp/test.log }
, Postfix < 3. ATM - script, , , .