Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
software:postgresql:pg12 [2020/12/13 09:52] – [PostGIS] christiansoftware:postgresql:pg12 [2020/12/30 01:42] – [Compiling PostgreSQL] christian
Line 31: Line 31:
 After an upgrade of the OS it seems that the LaunchDaemon is broken. After an upgrade of the OS it seems that the LaunchDaemon is broken.
  
-On their [[http://opensource.apple.com|OpenSource pages]] Apple provides a template for one of the [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/|older included PostgreSQL versions (here: 9.0.4)]]. This deviates a bit from what I used previously for the LaunchDaemon file.+The issues I encounter are related to file permissions for the log fileIn this case the user ''_postgresql'' does not have permissions to write to ''/var/log/Postgresql.log'' as only ''root'' as access here. This has likely changed between earlier Mac OS versions and Catalina (which is where the issue popped up)
  
-Verbatim copy of [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/org.postgresql.postgres.plist.auto.html|of Apple's org.postgresql.postgres.plist on their opensource site]] :+So there seems to be two options going forward: 
 + 
 +  - have ''pgsql'' directly log to the ''syslog'' 
 +  - use conventional ''stdout'' and ''stderr'' as log output directions, but change the logfile location  and permissions. 
 + 
 +On first sight is look as if option 1 is more elegant, but there is very little information as to how this should be set up and I have very little experience with ''syslog''
 + 
 +Here's a few links to get started: 
 + 
 +  * ''man asl.conf'' - manpage for Apple's system log tool 
 +  * [[https://nozaki.me/roller/kyle/entry/articles-postgres-log|Kohei Nozaki's blog entry]] on Postgresql using ''syslog'' 
 +  * [[https://superuser.com/questions/278231/how-to-disable-set-logging-level-preferences-per-mac-os-x-application| SO: log level prefs per OS X application]] 
 +  * [[https://superuser.com/questions/932013/asl-conf-doesnt-take-an-effect-on-my-enviroment-os-x-yosemite]] 
 +  * [[https://apple.stackexchange.com/questions/6559/setting-a-custom-log]] 
 +  * [[https://www.loggly.com/ultimate-guide/linux-logging-basics/|Linux logging basics]] 
 +  * [[https://apple.stackexchange.com/questions/338213/how-to-run-a-launchagent-that-runs-a-script-which-causes-failures-because-of-sys]] 
 +  * [[https://apple.stackexchange.com/questions/387592/how-to-use-launchd]] 
 +  * [[https://www.linuxwave.info/2018/12/send-postgresql-log-to-syslog.html|Getting postgresql write to syslog]] 
 +  * [[https://apple.stackexchange.com/questions/195997/running-postgres-as-launch-daemon]] 
 +  * [[https://developer.apple.com/documentation/os/logging]] 
 +  * [[https://apple.stackexchange.com/questions/357179/unified-logs-macos-high-sierra?rq=1]] 
 +  * [[https://apple.stackexchange.com/questions/162487/how-can-one-start-a-process-and-monitor-its-syslog-messages?rq=1]] 
 +  * [[https://apple.stackexchange.com/questions/390986/can-i-have-launchctl-output-stdout-stderr-from-my-application-to-the-system-wide?rq=1]] 
 +  * [[https://ilostmynotes.blogspot.com/2011/11/os-x-logging-aslconf-syslogconf-and.html]] 
 +  * [[https://www.unixtutorial.org/syslog-and-asl-in-macos/]] 
 +  * [[https://www.launchd.info]] 
 +  * [[https://superuser.com/questions/943983/os-x-launchdaemon-not-running-service-could-not-initialize]] 
 +  * [[https://stackoverflow.com/questions/27700596/homebrew-postgres-broken]] 
 +  * [https://apple.stackexchange.com/questions/322078/what-are-all-the-available-acl-attributes-in-mac-os-10-13-high-sierra]] 
 +  * [[https://unix.stackexchange.com/questions/479890/permission-to-write-to-log]] 
 +  * [[https://stackoverflow.com/questions/32160108/os-x-launchd-script-fails-to-run-at-startup?rq=1]] 
 +  *  
 + 
 + 
 + 
 + 
 +==== Setting up the LaunchDaemon ==== 
 + 
 +On their [[http://opensource.apple.com|OpenSource pages]] Apple provides a template for one of the  [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/|older included PostgreSQL versions (here: 9.0.4)]]. This deviates a bit from what I used previously for the LaunchDaemon file. 
 + 
 +[[https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html| Verbatim copy of [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/org.postgresql.postgres.plist.auto.html|of Apple's org.postgresql.postgres.plist on their opensource site]]:
  
 <file org.postgresql.postgres.plist> <file org.postgresql.postgres.plist>
Line 114: Line 154:
 </code> </code>
  
 +==== Starting the new PostgreSQL service ====
  
 +Once the 
  
 ===== PostGIS ===== ===== PostGIS =====