open(STDOUT, ">>$logpath") or die "Cannot redirect STDOUT: $!"; open(STDERR, ">>$logpath") or die "Cannot redirect STDERR: $!";