command-linepostgresql-9.4pg-restoreoutput-redirect

HOW to append pg_restore restoration log to file


I have tried multiple way to append log but not able to get.

for example.

pg_restore -U postgres -p5333 -d demodb < db_bkp_01_10_2019.dump >db_bkp_01_10_2019.log

pg_restore -U postgres -p5333 -d demodb < db_bkp_01_10_2019.dump 2>db_bkp_01_10_2019.log

pg_restore -U postgres -p5333 -d demodb < db_bkp_01_10_2019.dump 2&>db_bkp_01_10_2019.log

I want log related to restoration like what command executed on db while restoration.


Solution

  • You need to use the --verbose

    Try this command

    ./pg_restore -U postgres -p 5333 -d demodb < db_bkp_01_10_2019.dump --verbose 2>db_bkp_01_10_2019.log