I use launchd
to configure a service to write logs to the file.
This is the launchd config.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>my.label</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/binary</string>
<string>param</string>
</array>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/path/to/logfile.log</string>
<key>StandardOutPath</key>
<string>/path/to/logfile.log</string>
<key>UserName</key>
<string>root</string>
</dict>
</plist>
And I use the newsyslog to rotate the logs in the directory above. And the following it the newsyslog config line
/path/to/logfile.log 644 10 10000 * Z
newsyslog is able to rotate the logs. However, after rotation, launchd does not to write to the log file anymore. The last log line in the log file is.
newsyslog[2662]: logfile turned over due to -F request.
Is that a bug, or there is something wrong with the usage?