How to pass log file in pg_dump

13,366

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.

Share:
13,366
Java_Alert
Author by

Java_Alert

Updated on July 23, 2022

Comments

  • Java_Alert
    Java_Alert almost 2 years

    I am using this command to export.

    export PGPASSWOD=${PASSWORD}
    
        pg_dump –i –b -o -host=${HOST} -port=5444 -username=${USERNAME} -format=c -schema=${SCHEMA} --file=${SCHEMA}_${DATE}.dmp ${HOST} 
    

    Just want to know how can i include the log file in it so that i can get logs also.