pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Wen Yi <wen-yi@qq.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: logging_collector is off, but the logging is opening
Date: Wed, 26 Jul 2023 08:31:12 -0700
Message-ID: <f9bcca1d-afab-4ecb-d218-3a4c5cd5799d@aklaver.com> (raw)
In-Reply-To: <tencent_D55E5DE56A94292F645E5CBB1B8A348CCB06@qq.com>
References: <tencent_D55E5DE56A94292F645E5CBB1B8A348CCB06@qq.com>

On 7/25/23 14:43, Wen Yi wrote:
> Hi community,
> When I use the postgres, I check the log.(I use the -l open the log)
> As you can see, I type code like this:
> 
> postgres=# show logging_collector;
>   logging_collector
> -------------------
>   off
> (1 row)
> 
> postgres=# ^C
> 
> Follow the document, when logging_collector is off, there's no log 
> output, but when I check my 'postgres' directory:
> 
> [postgres@fedora postgres]$ ls
> build.sh  logfile  src  startdb.sh  stopdb.sh  update.sh
> [postgres@fedora postgres]$ cat logfile
> 2023-07-24 09:54:59.668 CST [35872] LOG:  starting PostgreSQL 17devel on 
> x86_64-pc-linux-gnu, compiled by gcc (GCC) 13.1.1 20230614 (Red Hat 
> 13.1.1-4), 64-bit
> 2023-07-24 09:54:59.668 CST [35872] LOG:  listening on IPv6 address 
> "::1", port 5432
> 2023-07-24 09:54:59.668 CST [35872] LOG:  listening on IPv4 address 
> "127.0.0.1", port 5432
> 2023-07-24 09:54:59.684 CST [35872] LOG:  listening on Unix socket 
> "/tmp/.s.PGSQL.5432"
> ...
> 
> In a word, the log is actually open. (My startup command: pg_ctl -l 
> logfile /home/postgres/postgres/bin/bin/pg_ctl -l logfile -D 
> /home/postgres/postgres/data start)
> So It's confuse me, the confilt of logging_collector & logfile.
> 
> Can someone give me some advice?

https://www.postgresql.org/docs/current/runtime-config-logging.html


Note

It is possible to log to stderr without using the logging collector; the 
log messages will just go to wherever the server's stderr is directed. 
However, that method is only suitable for low log volumes, since it 
provides no convenient way to rotate log files. Also, on some platforms 
not using the logging collector can result in lost or garbled log 
output, because multiple processes writing concurrently to the same log 
file can overwrite each other's output.


https://www.postgresql.org/docs/current/app-pg-ctl.html

-l filename
--log=filename

     Append the server log output to filename. If the file does not 
exist, it is created. The umask is set to 077, so access to the log file 
is disallowed to other users by default.


> Thanks in advance!
> 
> Yours,
> Wen Yi

-- 
Adrian Klaver
adrian.klaver@aklaver.com






view thread (2+ messages)

Message-ID: <f9bcca1d-afab-4ecb-d218-3a4c5cd5799d@aklaver.com>
Permalink:  ../f9bcca1d-afab-4ecb-d218-3a4c5cd5799d@aklaver.com/
Also on:    postgresql.org/message-id/f9bcca1d-afab-4ecb-d218-3a4c5cd5799d@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, wen-yi@qq.com
  Subject: Re: logging_collector is off, but the logging is opening
  In-Reply-To: <f9bcca1d-afab-4ecb-d218-3a4c5cd5799d@aklaver.com>
  References: <tencent_D55E5DE56A94292F645E5CBB1B8A348CCB06@qq.com> <f9bcca1d-afab-4ecb-d218-3a4c5cd5799d@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox