Skip to content

Commit cb14564

Browse files
Replace deprecated log_connections values in docs and tests
9219093 modularized log_connections output to allow more granular control over which aspects of connection establishment are logged. It converted the boolean log_connections GUC into a list of strings and deprecated previously supported boolean-like values on, off, true, false, 1, 0, yes, and no. Those values still work, but they are supported mainly for backwards compatability. As such, documented examples of log_connections should not use these deprecated values. Update references in the docs to deprecated log_connections values. Many of the tests use log_connections. This commit also updates the tests to use the new values of log_connections. In some of the tests, the updated log_connections value covers a narrower set of aspects (e.g. the 'authentication' aspect in the tests in src/test/authentication and the 'receipt' aspect in src/test/postmaster). In other cases, the new value for log_connections is a superset of the previous included aspects (e.g. 'all' in src/test/kerberos/t/001_auth.pl). Reported-by: Peter Eisentraut <peter@eisentraut.org> Author: Melanie Plageman <melanieplageman@gmail.com> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com> Discussion: https://postgr.es/m/e1586594-3b69-4aea-87ce-73a7488cdc97%40eisentraut.org
1 parent d376ab5 commit cb14564

File tree

20 files changed

+24
-21
lines changed

20 files changed

+24
-21
lines changed

doc/src/sgml/config.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
An example of what this file might look like is:
141141
<programlisting>
142142
# This is a comment
143-
log_connections = yes
143+
log_connections = all
144144
log_destination = 'syslog'
145145
search_path = '"$user", public'
146146
shared_buffers = 128MB
@@ -337,7 +337,7 @@ UPDATE pg_settings SET setting = reset_val WHERE name = 'configuration_parameter
337337
<option>-c name=value</option> command-line parameter, or its equivalent
338338
<option>--name=value</option> variation. For example,
339339
<programlisting>
340-
postgres -c log_connections=yes --log-destination='syslog'
340+
postgres -c log_connections=all --log-destination='syslog'
341341
</programlisting>
342342
Settings provided in this way override those set via
343343
<filename>postgresql.conf</filename> or <command>ALTER SYSTEM</command>,

src/backend/tcop/postgres.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3693,7 +3693,7 @@ set_debug_options(int debug_flag, GucContext context, GucSource source)
36933693

36943694
if (debug_flag >= 1 && context == PGC_POSTMASTER)
36953695
{
3696-
SetConfigOption("log_connections", "true", context, source);
3696+
SetConfigOption("log_connections", "all", context, source);
36973697
SetConfigOption("log_disconnections", "true", context, source);
36983698
}
36993699
if (debug_flag >= 2)

src/interfaces/libpq/t/005_negotiate_encryption.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
listen_addresses = '$hostaddr'
108108
109109
# Capturing the EVENTS that occur during tests requires these settings
110-
log_connections = on
110+
log_connections = 'receipt,authentication,authorization'
111111
log_disconnections = on
112112
trace_connection_negotiation = on
113113
lc_messages = 'C'

src/test/authentication/t/003_peer.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ sub test_role
7171

7272
my $node = PostgreSQL::Test::Cluster->new('node');
7373
$node->init;
74-
$node->append_conf('postgresql.conf', "log_connections = on\n");
74+
$node->append_conf('postgresql.conf', "log_connections = authentication\n");
7575
# Needed to allow connect_fails to inspect postmaster log:
7676
$node->append_conf('postgresql.conf', "log_min_messages = debug2");
7777
$node->start;

src/test/authentication/t/005_sspi.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Initialize primary node
1919
my $node = PostgreSQL::Test::Cluster->new('primary');
2020
$node->init;
21-
$node->append_conf('postgresql.conf', "log_connections = on\n");
21+
$node->append_conf('postgresql.conf', "log_connections = authentication\n");
2222
$node->start;
2323

2424
my $huge_pages_status =

src/test/authentication/t/007_pre_auth.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
$node->init;
2121
$node->append_conf(
2222
'postgresql.conf', q[
23-
log_connections = on
23+
log_connections = 'receipt,authentication'
2424
]);
2525

2626
$node->start;

src/test/kerberos/t/001_auth.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
'postgresql.conf', qq{
6666
listen_addresses = '$hostaddr'
6767
krb_server_keyfile = '$krb->{keytab}'
68-
log_connections = on
68+
log_connections = all
6969
log_min_messages = debug2
7070
lc_messages = 'C'
7171
});

src/test/ldap/t/001_auth.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
my $node = PostgreSQL::Test::Cluster->new('node');
4949
$node->init;
50-
$node->append_conf('postgresql.conf', "log_connections = on\n");
50+
$node->append_conf('postgresql.conf', "log_connections = all\n");
5151
# Needed to allow connect_fails to inspect postmaster log:
5252
$node->append_conf('postgresql.conf', "log_min_messages = debug2");
5353
$node->start;

src/test/ldap/t/002_bindpasswd.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
my $node = PostgreSQL::Test::Cluster->new('node');
4545
$node->init;
46-
$node->append_conf('postgresql.conf', "log_connections = on\n");
46+
$node->append_conf('postgresql.conf', "log_connections = all\n");
4747
$node->start;
4848

4949
$node->safe_psql('postgres', 'CREATE USER test0;');

src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242

4343
my $node = PostgreSQL::Test::Cluster->new('node');
4444
$node->init;
45-
$node->append_conf('postgresql.conf', "log_connections = on\n");
45+
$node->append_conf('postgresql.conf',
46+
"log_connections = 'receipt,authentication,authorization'\n");
4647
$node->append_conf('postgresql.conf',
4748
"shared_preload_libraries = 'ldap_password_func'");
4849
$node->start;

src/test/modules/oauth_validator/t/001_server.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
my $node = PostgreSQL::Test::Cluster->new('primary');
4747
$node->init;
48-
$node->append_conf('postgresql.conf', "log_connections = on\n");
48+
$node->append_conf('postgresql.conf', "log_connections = all\n");
4949
$node->append_conf('postgresql.conf',
5050
"oauth_validator_libraries = 'validator'\n");
5151
# Needed to allow connect_fails to inspect postmaster log:

src/test/modules/oauth_validator/t/002_client.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
my $node = PostgreSQL::Test::Cluster->new('primary');
2828
$node->init;
29-
$node->append_conf('postgresql.conf', "log_connections = on\n");
29+
$node->append_conf('postgresql.conf', "log_connections = all\n");
3030
$node->append_conf('postgresql.conf',
3131
"oauth_validator_libraries = 'validator'\n");
3232
$node->start;

src/test/postmaster/t/002_connection_limits.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
$node->append_conf('postgresql.conf', "max_connections = 6");
2121
$node->append_conf('postgresql.conf', "reserved_connections = 2");
2222
$node->append_conf('postgresql.conf', "superuser_reserved_connections = 1");
23-
$node->append_conf('postgresql.conf', "log_connections = on");
23+
$node->append_conf('postgresql.conf',
24+
"log_connections = 'receipt,authentication,authorization'");
2425
$node->append_conf('postgresql.conf', "log_min_messages=debug2");
2526
$node->start;
2627

src/test/postmaster/t/003_start_stop.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
$node->append_conf('postgresql.conf', "max_wal_senders = 0");
3434
$node->append_conf('postgresql.conf', "autovacuum_max_workers = 1");
3535
$node->append_conf('postgresql.conf', "max_worker_processes = 1");
36-
$node->append_conf('postgresql.conf', "log_connections = on");
36+
$node->append_conf('postgresql.conf',
37+
"log_connections = 'receipt,authentication,authorization'");
3738
$node->append_conf('postgresql.conf', "log_min_messages = debug2");
3839
$node->append_conf('postgresql.conf',
3940
"authentication_timeout = '$authentication_timeout s'");

src/test/recovery/t/013_crash_restart.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
$node->safe_psql(
2828
'postgres',
2929
q[ALTER SYSTEM SET restart_after_crash = 1;
30-
ALTER SYSTEM SET log_connections = 1;
30+
ALTER SYSTEM SET log_connections = receipt;
3131
SELECT pg_reload_conf();]);
3232

3333
# Run psql, keeping session alive, so we have an alive backend to kill.

src/test/recovery/t/022_crash_temp_files.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
$node->safe_psql(
2727
'postgres',
2828
q[ALTER SYSTEM SET remove_temp_files_after_crash = on;
29-
ALTER SYSTEM SET log_connections = 1;
29+
ALTER SYSTEM SET log_connections = receipt;
3030
ALTER SYSTEM SET work_mem = '64kB';
3131
ALTER SYSTEM SET restart_after_crash = on;
3232
SELECT pg_reload_conf();]);

src/test/recovery/t/032_relfilenode_reuse.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
$node_primary->append_conf(
1515
'postgresql.conf', q[
1616
allow_in_place_tablespaces = true
17-
log_connections=on
17+
log_connections=receipt
1818
# to avoid "repairing" corruption
1919
full_page_writes=off
2020
log_min_messages=debug2

src/test/recovery/t/037_invalid_database.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
autovacuum = off
1616
max_prepared_transactions=5
1717
log_min_duration_statement=0
18-
log_connections=on
18+
log_connections=receipt
1919
log_disconnections=on
2020
));
2121

src/test/ssl/t/SSL/Server.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ sub configure_test_server_for_ssl
200200
$node->append_conf(
201201
'postgresql.conf', <<EOF
202202
fsync=off
203-
log_connections=on
203+
log_connections=all
204204
log_hostname=on
205205
listen_addresses='$serverhost'
206206
log_statement=all

src/tools/ci/pg_ci_base.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ max_prepared_transactions = 10
88
# Settings that make logs more useful
99
log_autovacuum_min_duration = 0
1010
log_checkpoints = true
11-
log_connections = true
11+
log_connections = all
1212
log_disconnections = true
1313
log_line_prefix = '%m [%p][%b] %q[%a][%v:%x] '
1414
log_lock_waits = true

0 commit comments

Comments
 (0)