13

I've got a program that runs as a launchd agent, and I have stdout and stderr sent to a log file using the StandardErrorPath and StandardOutputPath keys. I'm quite keen on having stdout/stderr logged somewhere, and it seems like having launchd set this up would be the sensible thing.

(My intention was to suggest a file in ~/Library/Logs/ as a good setting. Then you can easily see the output in Console.app.)

Something I've noticed though is that launchd never seems to clean up these logs! I was expecting it to clear the log on each reboot, perhaps, or every few days, or something - but it seems not to. After a couple of weeks, I've got a 7MByte 22,000-line log file, virtually none of which is relevant. (It's highly unlikely you'd care about anything that happened before the last reboot, and in fact rather unlikely you'd care about anything that didn't happen in the last 15 minutes.)

Is there something I can do to stop the file growing indefinitely?

3
  • I have same issue with plist standardoutpath log file. seem there is no way to manage that out put file.
    – cidy.long
    Aug 25, 2016 at 21:50
  • 1
    Sounds like you're wanting log rotation Dec 20, 2022 at 11:03
  • Thanks. I don't work on (or use) this program any more, but that looks like about the sort of thing I was hoping for. For anybody else finding this later: there's also something called ASL, it seems, which sounds like it's related. Plenty of broken links to be found with Google!
    – Tom Seddon
    Dec 23, 2022 at 22:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.