Reputation: 14310
I've created a migration script in PowerShell for SVN to Git and I would to log the output of the command git svn clone
. When I run this like below, then I see that some lines like warnings and errors are not written to the log file. The rest of the lines are written to logs.txt
.
git svn clone "https://subversion/repo" "repo" > logs.txt
Same thing with
git svn clone "https://subversion/repo" "repo" | Out-File -FilePath logs.txt
I've also tried to use Start-Transcript logs.txt
and Stop-Transcript
but that logs nothing to the log file.
How could I log the warnigs and the errors to that log file?
Upvotes: 2
Views: 124
Reputation: 5598
You need to redirect stderr to the file. Notice the 2
git svn clone "https://subversion/repo" "repo" 2> logs.txt
1 is stdout
2 is stderr
To redirect stdout and stderr. Redirect stderr into stdout
git svn clone "https://subversion/repo" "repo" > logs.txt 2>&1
Upvotes: 2