The default postgresql.conf file created using initdb contains the following line
#logging_collector = off # Enable capturing of stderr and csvlog
Is there anyway to force initdb itself to generate a file with
logging_collector = on
rather than set options on pg-ctl or edit the generated file.
No, there is no way to do it like that.
But you can modify the file
postgresql.conf.samplein the “share” directory of the PostgreSQL installation, which is used as the blueprint forpostgresql.confduringinitdb.