我们如何将所有PostgreSQL输出(包括错误)发送到日志文件?

时间:2016-05-24 13:53:26

标签: sql postgresql psql

我已经在psql-shell中尝试过使用\ o和\ o打开和关闭标记的脚本,但它只记录结果。我正在寻找错误。 需要记录我们查询的所有结果,包括PSQL-shell中的错误。

1 个答案:

答案 0 :(得分:0)

如果在Linux中:

psql -f my_script.sql --echo-errors --echo-queries &> output.log

http://www.postgresql.org/docs/current/static/app-psql.html