Search Postgresql Archives

Re: "No transaction in progress" warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/05/09 18:26, Tom Lane wrote:
> Scott Mead <scott.lists@xxxxxxxxxxxxxxxx> writes:
>> How did you restart postgres?  I'm guessing that you're using a
>> distribution provided package.  If you're using the /etc/init.d
>> scripts from that package, it's likely that the startup script is
>> redirecting stderr and that the system is configured to use syslog
>> for the rest of the logging.
> 
> Right.  There are a number of messages that can appear at startup
> before the postmaster reads and adopts the "where to log" settings in
>  postgresql.conf.  Those early messages are going to go to
> postmaster's stderr.  What it sounds like is you're using a start
> script that points postmaster stderr to
> /var/log/postgresql/postgresql-8.3-main.log. I don't find that to be
> a tremendously good idea --- in my RPMs the early-startup messages go
> to a fixed file (/var/lib/pgsql/pgstartup.log) that's not dependent
> on what the "where to log" configuration settings are.

I looked into the startup scripts that are used here (Ubuntu 8.10): the
/etc/init.d script calls a Perl script and redirects that command's
stderr to stdin to capture warnings and errors:

ERRMSG=$(pg_ctlcluster 8.3 main start 2>&1)

The pg_ctlcluster script parses postgresql.conf and, if log_filename and
log_directory aren't defined there, adds '-l
/var/log/postgresql/postgresql-8.3-main.log' as an option for pg_ctl.
This file is created with the appropriate permissions if necessary.
The script then forks, and the child detaches itself from the terminal
and redirects stdout and stderr to /dev/null:

  setsid;
  dup2(POSIX::open('/dev/null', POSIX::O_WRONLY), 1);
  dup2(POSIX::open('/dev/null', POSIX::O_WRONLY), 2);
  exec $pg_ctl @options;

That doesn't look too bad to me, or at least it's how I would write a
daemon script, too. If I understand you correctly, stderr should be left
intact?

If this is not the preferred way to handle logging with Postgres, maybe
I should ask pg_ctlcluster's maintainer about it.


Regards,
  - Conrad

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux