如何在postgresql 9.4中更改startup.log的位置?

时间:2016-03-10 16:25:13

标签: postgresql logging

我当前的log_directory路径是

   /logs/demo/

但是仍然在默认日志位置

中创建了startup.log文件
/opt/demo/PostgreSQL/9.4/data/pg_log

我想将其更改为/ logs / demo

postgresql.conf文件看起来像

# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------

# - Where to Log -

log_destination = 'stderr'         # Valid values are combinations of
                                  # stderr, csvlog, syslog, and eventlog,
# This is used when logging to stderr:
logging_collector = on
# These are only used if logging_collector is on:
log_directory = '/logs/demo/'  #directorywherelogfiles are written
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'  # log file name pattern,


# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'

# This is only relevant when logging to eventlog (win32):
#event_source = 'PostgreSQL'

1 个答案:

答案 0 :(得分:0)

我不知道这对你的情况是否有帮助,因为日志文件仍然在原始位置,但是如果你想在/ logs / demo /中访问它,你可以对它进行符号链接:

ln -s /opt/demo/PostgreSQL/9.4/data/pg_log /logs/demo/pg_log