Thread: pgsql: Convert debug message from ereport to elog
Convert debug message from ereport to elog Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/8a07ebb3c172374aa2c83df61c4e05c059511c9a Modified Files -------------- src/backend/replication/logical/worker.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Just out of curiosity, what is the reason why you did this? I guess using elog instead of ereport for debugging message is preferable, while for non debugging messages using ereport is preferable, but actually sometimes elog is used for error messages in the file. Best regards, -- Tatsuo Ishii SRA OSS, Inc. Japan English: http://www.sraoss.co.jp/index_en.php Japanese:http://www.sraoss.co.jp From: Peter Eisentraut <peter_e@gmx.net> Subject: pgsql: Convert debug message from ereport to elog Date: Tue, 12 Jun 2018 15:36:49 +0000 Message-ID: <E1fSlLl-0001W4-Me@gemulon.postgresql.org> > Convert debug message from ereport to elog > > Branch > ------ > master > > Details > ------- > https://git.postgresql.org/pg/commitdiff/8a07ebb3c172374aa2c83df61c4e05c059511c9a > > Modified Files > -------------- > src/backend/replication/logical/worker.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >
> Just out of curiosity, what is the reason why you did this? I guess This made a message consistent with an analogous message in apply_handle_update() earlier in the file. > using elog instead of ereport for debugging message is preferable, > while for non debugging messages using ereport is preferable, but > actually sometimes elog is used for error messages in the file. I think this is not done perfectly consistently, and there are possibilities for improvement.
Peter, >> Just out of curiosity, what is the reason why you did this? I guess > > This made a message consistent with an analogous message in > apply_handle_update() earlier in the file. > >> using elog instead of ereport for debugging message is preferable, >> while for non debugging messages using ereport is preferable, but >> actually sometimes elog is used for error messages in the file. > > I think this is not done perfectly consistently, and there are > possibilities for improvement. Thanks for the explanation. Probably we want add/change something to "54.2. Reporting Errors Within the Server" In this section I see: There is an older function elog that is still heavily used. An elog call: : : Therefore, elog should be used only for internal errors and low-level debug logging. From the last sentence I feel like elog is not recommended for any puporse (and ereport will better even for this case). But if we prefer to use elog for internal errors and low-level debug logging over ereport, then above might be better changed something like: Therefore, elog should be used only for internal errors and low-level debug logging. Also for these purposes ereport should not be used. What do you think? -- Tatsuo Ishii SRA OSS, Inc. Japan English: http://www.sraoss.co.jp/index_en.php Japanese:http://www.sraoss.co.jp
On 6/15/18 06:53, Tatsuo Ishii wrote: > Therefore, elog should be used only for internal errors and low-level > debug logging. Also for these purposes ereport should not be used. ereport() has the advantage that if the debug level excludes the message, then the errmsg() call won't even be run and therefore the message doesn't have to be computed. So actually ereport() is preferable in many cases for debug messages. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services