changed log message formatting, fixed log output to stdout/stderr