added log support and stdout capture