运行 Mountain Lion 。通过 Postgres.app 安装PostgreSQL。通过PyCharm为Django使用postgres。我已经阅读了多个SO和blog posts关于让它工作,并且日志根本没有被创建。
我的conf文件(数据目录)位于此处:
$ ~/Library/Application\ Support/Postgres/var/postgresql.conf
我的 postgresql.conf日志记录设置如下所示:
log_destination = 'stderr'
logging_collector = on
log_directory = '~/Library/Logs/Postgres' (I've also tried 'pg_log')
我尝试关闭并打开Postgres.app
我还尝试重新启动命令行服务器:
$ /Applications/Postgres.app/Contents/MacOS/bin/pg_ctl restart -D ~/Library/Application\ Support/Postgres/var/
...但这导致终端挂在"LOG: autovacuum launcher started"
...并且日志打印到控制台。
This SO post is closely relevant,但我希望Postgres.app写入日志文件,而不是打印到控制台。
任何帮助都会很棒,谢谢。
编辑:回应vyegorov,
version = PostgreSQL 9.2.2
postgresql.conf中不存在silent_mode
答案 0 :(得分:14)
我让它为我工作。这是我正在使用的设置:
log_destination = 'stderr'
logging_collector = on
log_directory = '/tmp/'
log_filename = 'postgresql-%Y-%m-%d.log'
答案 1 :(得分:3)
在最新版本上它是
/Users/USERNAME/Library/Containers/com.heroku.postgres/Data/Library/Application Support/Postgres/var/postgresql.conf
psql -U existingdatabase_name_here
then SHOW config_file;