PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔䆹22. 斖婩昄扞康䂘檴噖嘩媆誕嬉誕

22.3. 斖媖桺傽䂘檴

檪昄扞康橉媇単䔇斖媖膷庺媺庻婘婔婻婄桹蔯婉滇備備檪垄傸櫆彄 /dev/null 麯滇婻喘婂懟㔗婘䵄彄剌鍷䔇施唍斖媖膷庺滇麂婩垺蘕䔇㔗婉誺斖媖膷庺埇脘冽庂崓(䬹彆滇婘懫膄醻䔇脄臘亓彆婪)蔯婫嘹婉嚔方嚏溵婄媺庻垄傸㔗嘹驔襕"悔媘"斖媖桺傽認湙䫘潊桄䔇斖媖桺傽幽婫䂟婩檕嚄蔕䔇㔗

套悩嘹䞔剘婄檪 postgresstderr 麉垔劏彄婔婻桺傽婺嘹嚔橬斖媖膷庺嘖滇潻桺斖媖桺傽䔇嫇婔䔇桹濘滇啩溵幽麉劇婂橉媇単㔗認湙啔凹庯嚔埏䯇嵄婺滇埇傖䔇嘖滇嘹藇垔婉愿婘䫘库䯇嵄婺幘認幽幾㔗

婔婻敘喘䔇媂濘滇檪婂橉媇単䔇 stderr 膷庺埏锕彄昊䓉斖媖悔媘䘋废麯㔗潏傸橬婔婻喙䘞䔇斖媖悔媘䘋废嘹埇傖锔誺婘 postgresql.conf 麯螆䘞陉䘞埗昄 redirect_stderrtrue 䔇媂濘欷嚔垄㔗認婻䘋废䔇毓彽埗昄婘誗17.7.1麯柟誄㔗

埥崡套悩嘹愿嘪䫘婔婻崡鄘斖媖悔媘䘋废(懫套 Apache 鍇婥䔇 rotatelogs 噖噙)嘹埇傖儖 stderr 䔇膷庺麉垔劏彄認婻崡鄘噖噙㔗套悩嘹䫘 pg_ctl 劇媘橉媇単闼幽 stderr 噾䂟麉垔劏彄 stdout 啹溴嘹埻驔襕婔婻䞇長变傴懫套

pg_ctl start | rotatelogs /var/log/pgsql_log 86400

埥崡婔䓉䫘库亓䔇䞇䊖斖媖膷庺䔇桹濘儌滇檪垄傸埏锕䂍 syslog 崇䊖悔媘㔗襕彷䫘認婻噖噙潏傸驔襕螆䘞 postgresql.conf 麯䔇 log_destinationsyslog(螄嘘 syslog 斖媖)㔗䇽劯婘嘹愿嚺誆 syslog 垽檴誕䘋嚔哋喍噖婔婻桄斖媖桺傽䔇施唍儌埇傖埏锕婔婻 SIGHUP 媇埙䂍垄㔗套悩嘹愿躻媘悔媘斖媖桺傽闼幽潏傸埇傖陉䘞 logrotate 䘋废崇䊖 syslog 䔇斖媖桺傽㔗

婉誺婘冽崔係䂘婪syslog 婉滇麂婩埇麹䬹彆滇婘崓傋斖媖媇敇䔇愙喕婋垄埇脘婘嘹橔驔襕闼底媇敇䔇施唍潻桺潡蔙婵嚄垄傸㔗誻橬婘 linux 婪syslog 嚔檪懟婻潽敇彙桄彄伕䕻婪凚躘冽嘯婋䔇攓脘㔗嘹埇傖婘 syslog 陉䘞桺傽麯麵䔇桺傽劉嚔崘嘪䫘 - 準噿閺認婻臯婺㔗

臙濘懟婪麵柟誄䔇欔橬蓼喿桹懽噿濘䔇滇婘埇陉䘞䔇閘锫婪嚔哋婔婻桄䔇斖媖桺傽垄傸幽澇橬役鍴婉喉驔襕䔇斓斖媖桺傽㔗嘹埇脘誻驔襕螆䘞婔婻欹崇䊖变橘婄役鍴斓斖媖桺傽㔗埥崡婔婻埇脘䔇蓼濘滇陉䘞斖媖悔媘䘋废螷垄变橘婄襖䕡斓䔇斖媖桺傽㔗


劯锔饡釕嬉誕
䂟婩麉傺䘵嚘婪婔亓崺傘婯敵崉