Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass log file in pg_dump

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.

like image 642
Java_Alert Avatar asked Dec 07 '22 02:12

Java_Alert


1 Answers

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.

like image 52
harmic Avatar answered Dec 26 '22 16:12

harmic