Thread: How to log to postgresql.log

How to log to postgresql.log

From
A B
Date:
Hi.
I'd like to log everything to PGDATA/pg_log/postgresql.log  with
rotation when it reaches the size of 1kB (yes, that is not much, but
I'll increase when I see it work)
I have
these lines uncommented in the postgresql.conf file.

logging_collector = on
log_directory = 'pg_log'
log_filename = 'postgresql.log'
log_truncate_on_rotation = off
log_rotation_size = 1kB

But I get  files

postgresql.log.1233263415
postgresql.log.1233263531

so it starts new logs each time I start the server.
Why? I don't want the extra part in the file name. How do I get rid of them?

Re: How to log to postgresql.log

From
Tom Lane
Date:
A B <gentosaker@gmail.com> writes:
> But I get  files
> postgresql.log.1233263415
> postgresql.log.1233263531

That's what it's defined to do when you set log_filename to a constant.
The expected use pattern involves putting some strftime percent-escapes
into the log_filename pattern.  See the examples in the 'where to log'
section of the manual (look under log_truncate_on_rotation in
particular).

            regards, tom lane