In these logs you’ll see the logs from me starting the database, connecting to it from some other terminal, and issuing the obviously erroneous command “select syntax error”. But there are several ways to redirect this elsewhere. The easiest is with pg_ctl’s -l option, which essentially redirects stderr to a file, in which case the startup looks like this:
#os-session> pg_ctl -l logfile -D $PGDATA start
Finally, you can also tell PostgreSQL to redirect its stderr output internally, with the logging_collector option (which older versions of PostgreSQL named “redirect_stderr”). This can be on or off, and when on, collects stderr output into a configured log directory.
So if you end see a log_destination set to “stderr”, a good next step is to check logging_collector:
#postgres-db-session> show logging_collector ;