I am in the middle of developing a C extension library for PostgreSQL. I am using a lot of ereport() calls to help with future debugging.
A typical example of usage in my code would be something like this:
ereport(NOTICE, (errmsg("[%s]: Returned nonzero result (%d).", (const char*)__FUNCTION__, ret)) );
However, when I look in /var/log/postgresql/postgresql-8.4-main.log my messages do not seem to be appearing there – only messages from what I assume is the db server daemon.
So, where are my log messages being stored?
BTW, I am running PG 8.4 on Ubuntu Linux (10.0.4)
By default, logging of non-critical messages is not enabled on fresh installs. You configure it by setting
log_destinationandlogging_collector.PostgreSQL has several logging levels, and by default,
NOTICElevel is not saved to log files (even when they are enabled) . This is configured bylog_min_messagessetting. HoweverNOTICEit emitted to client by default. This is configured byclient_min_messagessetting.So if you want these to be stored in log files, you will have to either change
NOTICEtoWARNINGin your code, or setlog_min_messages = notice.See this http://www.postgresql.org/docs/8.4/static/runtime-config-logging.html
and maybe this http://www.depesz.com/index.php/2011/05/06/understanding-postgresql-conf-log/