I have a launchd job that periodically runs in the background. Any stdout and stderr output during the job is logged to some files set in the job's plist using the StandardOutPath and StandardErrorPath keys. However, these log files are overwritten every time the job runs. Instead, I want to have the logs appended. Can this be configured?

The documentation (seems) to not mention anything about appending / overwriting.

  • 2
    In case someone thinks this is a software development question? An answer about whether/how launchd can be configured would be perfectly on-topic, as would pointing out that this needs to be handled by the daemon itself. – nohillside Sep 4 '19 at 11:19
  • developer.apple.com/library/archive/technotes/tn2083/… Which logger are you using? At the further readings of this linked page, there are multiple logging techniques given. Also, Can you use verbose mode? lastly, developer.apple.com/library/archive/technotes/tn2124/… has some details too. Since you didn't mention these in the question, I assumed that you didnt read them (notify me by @ankiiiiiii) – anki Sep 4 '19 at 20:19
  • @Erik Can you share more details about your setup? - It sounds very odd as the default behavior is that the log files are appended - and not overwritten. So you must have something special set up since you say your files are being overwritten by something. – jksoegaard Sep 4 '19 at 20:24
  • launchd jobs that use <key>StandardErrorPath</key> and <key>StandardOutPath</key> should always append rather than overwrite unless there is something specifically being done to overwrite them. We'd need to know what you're using to generate output to figure out why it's happening that way. – TJ Luoma Sep 5 '19 at 0:35

You must log in to answer this question.

Browse other questions tagged .