{"action":"created","issue":{"url":"https://api.github.com/repos/mholt/caddy/issues/769","repository_url":"https://api.github.com/repos/mholt/caddy","labels_url":"https://api.github.com/repos/mholt/caddy/issues/769/labels{/name}","comments_url":"https://api.github.com/repos/mholt/caddy/issues/769/comments","events_url":"https://api.github.com/repos/mholt/caddy/issues/769/events","html_url":"https://github.com/mholt/caddy/issues/769","id":149163558,"number":769,"title":"RFE: specific stdout/stderr format when running as systemd service","user":{"login":"eliasp","id":48491,"avatar_url":"https://avatars.githubusercontent.com/u/48491?v=3","gravatar_id":"","url":"https://api.github.com/users/eliasp","html_url":"https://github.com/eliasp","followers_url":"https://api.github.com/users/eliasp/followers","following_url":"https://api.github.com/users/eliasp/following{/other_user}","gists_url":"https://api.github.com/users/eliasp/gists{/gist_id}","starred_url":"https://api.github.com/users/eliasp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eliasp/subscriptions","organizations_url":"https://api.github.com/users/eliasp/orgs","repos_url":"https://api.github.com/users/eliasp/repos","events_url":"https://api.github.com/users/eliasp/events{/privacy}","received_events_url":"https://api.github.com/users/eliasp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-18T14:15:01Z","updated_at":"2016-04-18T15:09:10Z","closed_at":null,"body":"# Request For Enhancement\r\n## specific stdout/stderr format when running as systemd service\r\n\r\nI'd like to see a slightly adapted format for stdout/stderr messages to be used when Caddy detects it is running as systemd service.\r\nCurrently, the output in `systemctl status caddy@foobar.service` looks like this:\r\n```\r\nApr 18 15:43:10 moria systemd[1]: Starting Caddy HTTP/2 web server for app_backend...\r\nApr 18 15:43:10 moria systemd[1]: Started Caddy HTTP/2 web server for app_backend.\r\nApr 18 15:43:10 moria caddy[19203]: Activating privacy features...2016/04/18 15:43:10 [api.company.tld] failed to get certificate: [api.company.tld] error presenting token: Could not start HTTP server for challenge -> listen tcp :80: bind: permission denied\r\nApr 18 15:43:10 moria systemd[1]: caddy@app_backend.service: main process exited, code=exited, status=1/FAILURE\r\nApr 18 15:43:10 moria systemd[1]: Unit caddy@app_backend.service entered failed state.\r\n```\r\nThe problems here:\r\n- all messages are crammed into a single line before they're flushed to stdout/stderr (see line#3 of the paste above)\r\n- each line contains a timestamp which is already provided in a better/generic way by systemd's journal\r\n\r\n[coreos/go-systemd](https://github.com/coreos/go-systemd) provides the [`util.RunningFromSystemService()`](https://github.com/coreos/go-systemd/blob/master/util/util.go#L150) method which takes care of the detection.\r\n\r\nThis is not about [implementing full systemd journal support](https://github.com/coreos/go-systemd/blob/master/journal/journal.go), which would also be nice, but only about making sure the status output of the caddy service looks sane."},"comment":{"url":"https://api.github.com/repos/mholt/caddy/issues/comments/211421204","html_url":"https://github.com/mholt/caddy/issues/769#issuecomment-211421204","issue_url":"https://api.github.com/repos/mholt/caddy/issues/769","id":211421204,"user":{"login":"mholt","id":1128849,"avatar_url":"https://avatars.githubusercontent.com/u/1128849?v=3","gravatar_id":"","url":"https://api.github.com/users/mholt","html_url":"https://github.com/mholt","followers_url":"https://api.github.com/users/mholt/followers","following_url":"https://api.github.com/users/mholt/following{/other_user}","gists_url":"https://api.github.com/users/mholt/gists{/gist_id}","starred_url":"https://api.github.com/users/mholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mholt/subscriptions","organizations_url":"https://api.github.com/users/mholt/orgs","repos_url":"https://api.github.com/users/mholt/repos","events_url":"https://api.github.com/users/mholt/events{/privacy}","received_events_url":"https://api.github.com/users/mholt/received_events","type":"User","site_admin":false},"created_at":"2016-04-18T15:09:09Z","updated_at":"2016-04-18T15:09:09Z","body":"Caddy has a \"central logging facilitiy\" -- the process log, which is what you're seeing here.\r\n\r\nBut you're logging more than just stderr, you're also logging stdout, which is not entirely useful. The \"crammed into a single line\" is a result of logging more than just stderr.\r\n\r\nI'd rather have the timestamp logged twice than not at all; this seems mainly to be an aesthetic request?"}}