pgsql: Change replication connection log format to allow for a database

Started by Simon Riggsover 16 years ago6 messagescomitters
Jump to latest
#1Simon Riggs
simon@2ndQuadrant.com

Log Message:
-----------
Change replication connection log format to allow for a database
called replication. Add host and port details, following format
of messages in BackendInitialize().

Modified Files:
--------------
pgsql/src/backend/utils/init:
postinit.c (r1.206 -> r1.207)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/init/postinit.c?r1=1.206&r2=1.207)

#2Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Simon Riggs (#1)
Re: pgsql: Change replication connection log format to allow for a database

Simon Riggs wrote:

Log Message:
-----------
Change replication connection log format to allow for a database
called replication. Add host and port details, following format
of messages in BackendInitialize().

Thanks!

I'm afraid this doesn't translate well:

--- 222,232 ----
*/
if (am_walsender)
ereport(LOG,
! 				(errmsg("replication connection authorized: user=%s host=%s%s%s",
! 						port->user_name,
! 						port->remote_host, port->remote_port[0] ? " port=" : "",
! 						port->remote_port)));
! 
else if (Log_connections)
ereport(LOG,
(errmsg("connection authorized: user=%s database=%s",

If you want display the port (I'm not sure if it's of much interest),
I'd suggest something like:

if (port->remote_port[0])
ereport(LOG,
(errmsg("replication connection authorized: user=%s host=%s port=%s",
port->user_name,
port->remote_host,
port->remote_port[0])));
else
ereport(LOG,
(errmsg("replication connection authorized: user=%s host=%s",
port->user_name,
port->remote_host)));

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

#3Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Heikki Linnakangas (#2)
Re: pgsql: Change replication connection log format to allow for a database

Heikki Linnakangas wrote:

I'm afraid this doesn't translate well:

--- 222,232 ----
*/
if (am_walsender)
ereport(LOG,
! 				(errmsg("replication connection authorized: user=%s host=%s%s%s",
! 						port->user_name,
! 						port->remote_host, port->remote_port[0] ? " port=" : "",
! 						port->remote_port)));
! 
else if (Log_connections)
ereport(LOG,
(errmsg("connection authorized: user=%s database=%s",

Ok, I just realized that this was copy-pasted from BackendInitialize, so
I guess it's OK as it is...

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Heikki Linnakangas (#3)
Re: pgsql: Change replication connection log format to allow for a database

Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:

Heikki Linnakangas wrote:

I'm afraid this doesn't translate well:

--- 222,232 ----
*/
if (am_walsender)
ereport(LOG,
! 				(errmsg("replication connection authorized: user=%s host=%s%s%s",
! 						port->user_name,
! 						port->remote_host, port->remote_port[0] ? " port=" : "",
! 						port->remote_port)));
! 
else if (Log_connections)
ereport(LOG,
(errmsg("connection authorized: user=%s database=%s",

Ok, I just realized that this was copy-pasted from BackendInitialize, so
I guess it's OK as it is...

Two flat-out violations of our message style guidelines doesn't make it
right. I agree with your proposed change for both.

regards, tom lane

#5Simon Riggs
simon@2ndQuadrant.com
In reply to: Tom Lane (#4)
Re: pgsql: Change replication connection log format to allow for a database

On Thu, 2010-03-25 at 13:00 -0400, Tom Lane wrote:

Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:

Ok, I just realized that this was copy-pasted from BackendInitialize, so
I guess it's OK as it is...

Two flat-out violations of our message style guidelines doesn't make it
right. I agree with your proposed change for both.

The proposed change makes sense and I'm happy to do it.

--
Simon Riggs www.2ndQuadrant.com

#6Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Heikki Linnakangas (#3)
Re: pgsql: Change replication connection log format to allow for a database

Heikki Linnakangas wrote:

Heikki Linnakangas wrote:

I'm afraid this doesn't translate well:

--- 222,232 ----
*/
if (am_walsender)
ereport(LOG,
! 				(errmsg("replication connection authorized: user=%s host=%s%s%s",
! 						port->user_name,
! 						port->remote_host, port->remote_port[0] ? " port=" : "",
! 						port->remote_port)));
! 
else if (Log_connections)
ereport(LOG,
(errmsg("connection authorized: user=%s database=%s",

Ok, I just realized that this was copy-pasted from BackendInitialize, so
I guess it's OK as it is...

Actually it would be good to correct both per your previous suggestion.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.