How log pg_dump / pg_restore

From: Edwin UY <edwin(dot)uy(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: How log pg_dump / pg_restore
Date: 2025-02-28 10:45:10
Message-ID: CA+wokJ8Xxv6CBSaKhybFFHpmGuBjRyCkv0vGwVvbhcpUnmH_7Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

Is there a trick somehow to be able to log the output of pg_dump /
pg_restore

I have this shell script to start with.

#!/bin/bash

SECONDS=0
START_pgdump=$( date )

pg_dump -v -d abcdb-U abc \
-h abchost \
--if-exists --clean -Fc \
-f abcdumpfile.dmp \
--quote-all-identifiers -n abc | tee -a pg_dump.log 2>pg_dump.err

FINISH_pgdump=$( date )

echo "START_pgdump = ${START_pgdump}"
echo "FINISH_pgdump = ${FINISH_pgdump}"
echo "SECONDS = ${SECONDS}"

IF I do

--quote-all-identifiers -n abc 1>pg_dump.log 2>pg_dump.err

I get the output but in the pg_dump.err. I'm confused. Any thoughts?

The main reason for wanting to capture the output is for where there are
too many objects to pg_dump and it can be difficult scrolling through the
screen to check for errors.

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2025-02-28 13:27:50 Re: Multi-MASTER across different locations
Previous Message ek ek 2025-02-28 08:21:47 multi master issues