How to pass log file in pg_dump How to pass log file in pg_dump postgresql postgresql

How to pass log file in pg_dump


I assume you mean you want to capture any errors, notifications, etc that are output by pg_dump in a file.

There is no specific option for this, but pg_dump will write these to STDERR, so you can easily capture them like this:

pg_dump –i –b -o ...other options ... 2> mylogfile.log

In a shell, 2> redirects STDERR to the given file.

This advice is good for nearly any command line tool you are likely to find on a *nix system.