1

In launchd, you can change the path of the log files using StandardOutPath and StandardErrorPath in .plist file, but when I used it to output a log returned by the process, the resultant log files didn't add a timestamp and hence I cannot tell when each line is written nor when the process is run to begin with.

So is it feasible to add the timestamp information to the log files? The minimum requirement is month, day, hour, minute, and second.

3

The keys you mention don't redirect log files, they redirect the standard output/error streams. It is the responsibility of the program writing to those streams to add timestamp information.

-1

You could include the date command in ProgramArguments before your program path in your launchd .plist:

<key>ProgramArguments</key> <array> <string>/bin/bash</string> <string>-c</string> <string>date; program-path-here</string> </array>

It's the equivalent of running /bin/bash -c "date; program-path-here"

  • the log output does not necessarily read an environment variable - and also this is one time for the whole file - and the OP wants different times on each line – user151019 Sep 23 '14 at 0:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .