if you think that this is not the proper section of SE where to post a question like this, tell me where should I put it and I will move it.
Anyway. I have a git daemon
set up on my OS X machine which runs under launchd, here is the .plist file inside /Library/LaunchDaemons/
:
<?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>org.git.daemon</string>
<key>UserName</key>
<string>git-ro</string>
<key>GroupName</key>
<string>git-ro</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/git</string>
<string>daemon</string>
<string>--inetd</string>
<string>--reuseaddr</string>
<string>--verbose</string>
<string>--base-path=/Users/git/GitRepositories/</string>
<string>/Users/git/GitRepositories/</string>
</array>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>git</string>
<key>SockType</key>
<string>stream</string>
<key>SockFamily</key>
<string>IPv4</string>
</dict>
</dict>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
</dict>
</plist>
Everything works like a charm, but the daemon logs its information into /var/log/system.log
. Is there a way to tell it to log its information (stdout, stderr) into a dedicated file, e.g. like /var/log/git.log
?
Edit: I have also tried to add the StandardOutPath
and StandardErrPath
keys to the .plist, but doing so makes launchd unable to start the git daemon for some reasons of which I am not aware of (I see a Service could not initialize:
for git daemon in /var/log/system.log
):
...
<key>StandardOutPath</key>
<string>/var/log/git.log</string>
<key>StandardErrorPath</key>
<string>/var/log/git.log</string>
...
Edit: I edited the .plist file and the daemon works with this configuration (StandardOutPath, StandardErrorPath seem to give problems, too). Here is the working one:
<?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>org.git.daemon</string>
<key>UserName</key>
<string>git-ro</string>
<key>GroupName</key>
<string>staff</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/git</string>
<string>daemon</string>
<string>--inetd</string>
<string>--reuseaddr</string>
<string>--verbose</string>
<string>--base-path=/Users/git/GitRepositories/</string>
<string>/Users/git/GitRepositories/</string>
</array>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>git</string>
<key>SockType</key>
<string>stream</string>
<key>SockFamily</key>
<string>IPv4</string>
</dict>
</dict>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
</dict>
</plist>
Now, how can I redirect the daemon's logs into a file like e.g. /var/log/git.log
?