Log prefix missing for subscriber log messages received from publisher

From: vignesh C <vignesh21(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Log prefix missing for subscriber log messages received from publisher
Date: 2025-04-15 04:37:24
Message-ID: CALDaNm2xsHpWRtLm-VL_HJCsaE3+1Y_n-jDEAr3-suxVqc3xoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Currently, when a warning is emitted by the publisher, the
corresponding log message does not include the log prefix. This makes
it harder to correlate such messages with other log entries. For
example, in a simulated error scenario where directory removal fails,
the notice message lacks the standard log prefix, as shown below:
2025-03-18 16:44:36.071 IST [196901] LOG: logical replication table
synchronization worker for subscription "sub1", table "t1" has
finished
WARNING: could not remove directory
"pg_replslot/pg_16398_sync_16387_7483106341004194035.tmp"

In this case, the WARNING line does not include the usual timestamp
information, making it harder to trace.

To address this, we can have a custom notice processor for WAL
receiver connections—similar to what's done in the attached patch.
This ensures that notices received during both streaming and logical
replication include the appropriate log prefix. Since this issue is
present in both replication modes, the patch sets the notice processor
for all WAL receiver connections.

Regards,
Vignesh

Attachment Content-Type Size
register_notice_process.patch application/octet-stream 781 bytes

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2025-04-15 05:00:00 Re: Recent pg_rewind test failures in buildfarm
Previous Message Amul Sul 2025-04-15 04:22:19 pg_combinebackup: correct code comment.