How do I get the output messages from ogr2ogr, when I call it from another windows application?

I have tried with standard "ogr2ogr.exe>log.txt", but it keeps writing to the console.

  • Do you call it from a batch file or how? – user30184 Jan 31 '18 at 12:58
  • 2
    try piping the error output stream too ogr2ogr.exe>log.txt 2>&1 – JGH Jan 31 '18 at 13:02
  • The part with 2>&1 helped, thanks. Never seen that before. – Uffe Kousgaard Jan 31 '18 at 16:48

There are two output streams for a console. 1 is the standard output and 2 is the error output stream. When you do my.exe > myfile.txt it send the standard output (1) to the file, and keeps the error in the console. You could want to send the errors to a different file, or to the standard output. To do this, you would indicate to send the errors (2) to the standard output stream (1) my.exe > myfile.txt 2>&1 This old but accurate doc gives further details.

For the case you reported, the command would be ogr2ogr.exe>log.txt 2>&1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.