How can I set logging level for Heroku Postgresql?

强颜欢笑 提交于 2019-12-05 15:22:57

As of August 8th 2017, Heroku Postgres now offers the ability to change this via the PGSettings feature. For example the command to log all statements on a standard-0 or above (no hobby plans) would be:

heroku pg:settings:log-statement all postgresql-large-1234 -a sushi

ref: https://devcenter.heroku.com/articles/heroku-postgres-settings#log-statement

  1. You interpreted documentation wrongly. The log_statement parameter doesn't allow the error value. Possible values are instead: none, ddl, mod, all (and default pseudo-value).

    You may also want to change log_min_messages parameter or log_min_error_statement parameter. They allow these values: DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, LOG, NOTICE, WARNING, ERROR, FATAL and PANIC. Set PANIC for minimal logging.

  2. The fact is that for all three aforementioned parameters documentation says:

    Only superusers can change this setting.

    So, unless you can connect to PostgreSQL database as the postgres user or edit PostgreSQL configuration files directly, you probably cannot change logging options.

    You may ask Heroku support about some workarounds. But I don't see how you can change logging options, because they probably won't give you superuser access. Maybe you can ask them to do that for you (i.e. change logging options) or you can use some special tools to filter logs (without changing logging options), I don't know.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!