{"action":"created","comment":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/24750433","id":24750433,"diff_hunk":"@@ -118,31 +160,27 @@ def _parse_options(self, arguments):\n \n     def main(self):\n         \"\"\"Parse arguments and run the script's main function via ``react``.\"\"\"\n-        observer = None\n-        try:\n-            if not self.log_directory.exists():\n-                self.log_directory.makedirs()\n-            log_path = self.log_directory.child(\n-                b\"%s-%d.log\" % (os.path.basename(self.sys_module.argv[0]),\n-                                os.getpid()))\n-            log_file = log_path.open(\"a\")\n-            observer = FileLogObserver(log_file).emit\n-            addObserver(observer)\n-            msg(\"Arguments: %s\" % (self.sys_module.argv,))\n-        except (OSError, IOError):\n-            pass\n-\n+        # If e.g. --version is called this may throw a SystemExit, so we\n+        # always do this first before any side-effecty code is run:\n         options = self._parse_options(self.sys_module.argv[1:])\n+\n+        if self.logging:\n+            log_writer = ThreadedFileWriter(self.sys_module.stdout,\n+                                            self._reactor)\n+            log_writer.startService()\n+            self._reactor.addSystemEventTrigger(\"during\", \"shutdown\",\n+                                                log_writer.stopService)\n+            observer = EliotObserver()\n+            # We don't bother shutting this down; the process will exit\n+            # once we return from this function. The ThreadedFileWriter in\n+            # contrast needs to be shutdown because it starts a thread\n+            # that will keep the process from existing.","path":"flocker/common/script.py","position":124,"original_position":124,"commit_id":"251847100be31ba5a34d2a73b7f81e6f2b5845c3","original_commit_id":"251847100be31ba5a34d2a73b7f81e6f2b5845c3","user":{"login":"wallrj","id":978965,"avatar_url":"https://avatars.githubusercontent.com/u/978965?v=3","gravatar_id":"","url":"https://api.github.com/users/wallrj","html_url":"https://github.com/wallrj","followers_url":"https://api.github.com/users/wallrj/followers","following_url":"https://api.github.com/users/wallrj/following{/other_user}","gists_url":"https://api.github.com/users/wallrj/gists{/gist_id}","starred_url":"https://api.github.com/users/wallrj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wallrj/subscriptions","organizations_url":"https://api.github.com/users/wallrj/orgs","repos_url":"https://api.github.com/users/wallrj/repos","events_url":"https://api.github.com/users/wallrj/events{/privacy}","received_events_url":"https://api.github.com/users/wallrj/received_events","type":"User","site_admin":false},"body":"Typo \"existing\"","created_at":"2015-02-16T13:30:36Z","updated_at":"2015-02-16T13:30:36Z","html_url":"https://github.com/ClusterHQ/flocker/pull/1156#discussion_r24750433","pull_request_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1156","_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/24750433"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1156#discussion_r24750433"},"pull_request":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1156"}}},"pull_request":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1156","id":29305288,"html_url":"https://github.com/ClusterHQ/flocker/pull/1156","diff_url":"https://github.com/ClusterHQ/flocker/pull/1156.diff","patch_url":"https://github.com/ClusterHQ/flocker/pull/1156.patch","issue_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1156","number":1156,"state":"open","locked":false,"title":"[FLOC-936] Eliot logging for flocker-control and flocker-zfs-agent","user":{"login":"itamarst","id":3266662,"avatar_url":"https://avatars.githubusercontent.com/u/3266662?v=3","gravatar_id":"","url":"https://api.github.com/users/itamarst","html_url":"https://github.com/itamarst","followers_url":"https://api.github.com/users/itamarst/followers","following_url":"https://api.github.com/users/itamarst/following{/other_user}","gists_url":"https://api.github.com/users/itamarst/gists{/gist_id}","starred_url":"https://api.github.com/users/itamarst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itamarst/subscriptions","organizations_url":"https://api.github.com/users/itamarst/orgs","repos_url":"https://api.github.com/users/itamarst/repos","events_url":"https://api.github.com/users/itamarst/events{/privacy}","received_events_url":"https://api.github.com/users/itamarst/received_events","type":"User","site_admin":false},"body":"https://clusterhq.atlassian.net/browse/FLOC-936","created_at":"2015-02-13T22:36:43Z","updated_at":"2015-02-16T13:30:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ad90865e253d0723ab442b45817cf74cbb64da3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1156/commits","review_comments_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1156/comments","review_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1156/comments","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/251847100be31ba5a34d2a73b7f81e6f2b5845c3","head":{"label":"ClusterHQ:logging-FLOC-936","ref":"logging-FLOC-936","sha":"251847100be31ba5a34d2a73b7f81e6f2b5845c3","user":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":19248542,"name":"flocker","full_name":"ClusterHQ/flocker","owner":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ClusterHQ/flocker","description":"Easily manage Docker containers & their data","fork":false,"url":"https://api.github.com/repos/ClusterHQ/flocker","forks_url":"https://api.github.com/repos/ClusterHQ/flocker/forks","keys_url":"https://api.github.com/repos/ClusterHQ/flocker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ClusterHQ/flocker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ClusterHQ/flocker/teams","hooks_url":"https://api.github.com/repos/ClusterHQ/flocker/hooks","issue_events_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/events{/number}","events_url":"https://api.github.com/repos/ClusterHQ/flocker/events","assignees_url":"https://api.github.com/repos/ClusterHQ/flocker/assignees{/user}","branches_url":"https://api.github.com/repos/ClusterHQ/flocker/branches{/branch}","tags_url":"https://api.github.com/repos/ClusterHQ/flocker/tags","blobs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ClusterHQ/flocker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/refs{/sha}","trees_url":"https://api.github.com/repos/ClusterHQ/flocker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/{sha}","languages_url":"https://api.github.com/repos/ClusterHQ/flocker/languages","stargazers_url":"https://api.github.com/repos/ClusterHQ/flocker/stargazers","contributors_url":"https://api.github.com/repos/ClusterHQ/flocker/contributors","subscribers_url":"https://api.github.com/repos/ClusterHQ/flocker/subscribers","subscription_url":"https://api.github.com/repos/ClusterHQ/flocker/subscription","commits_url":"https://api.github.com/repos/ClusterHQ/flocker/commits{/sha}","git_commits_url":"https://api.github.com/repos/ClusterHQ/flocker/git/commits{/sha}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/comments{/number}","issue_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/comments/{number}","contents_url":"https://api.github.com/repos/ClusterHQ/flocker/contents/{+path}","compare_url":"https://api.github.com/repos/ClusterHQ/flocker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ClusterHQ/flocker/merges","archive_url":"https://api.github.com/repos/ClusterHQ/flocker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ClusterHQ/flocker/downloads","issues_url":"https://api.github.com/repos/ClusterHQ/flocker/issues{/number}","pulls_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls{/number}","milestones_url":"https://api.github.com/repos/ClusterHQ/flocker/milestones{/number}","notifications_url":"https://api.github.com/repos/ClusterHQ/flocker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ClusterHQ/flocker/labels{/name}","releases_url":"https://api.github.com/repos/ClusterHQ/flocker/releases{/id}","created_at":"2014-04-28T18:02:14Z","updated_at":"2015-02-15T17:38:22Z","pushed_at":"2015-02-16T11:57:27Z","git_url":"git://github.com/ClusterHQ/flocker.git","ssh_url":"git@github.com:ClusterHQ/flocker.git","clone_url":"https://github.com/ClusterHQ/flocker.git","svn_url":"https://github.com/ClusterHQ/flocker","homepage":"https://clusterhq.com","size":39122,"stargazers_count":1187,"watchers_count":1187,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":20,"forks":58,"open_issues":20,"watchers":1187,"default_branch":"master"}},"base":{"label":"ClusterHQ:master","ref":"master","sha":"4720fc303a65b93ae3db11bc87eb6b43ba4322a0","user":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":19248542,"name":"flocker","full_name":"ClusterHQ/flocker","owner":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ClusterHQ/flocker","description":"Easily manage Docker containers & their data","fork":false,"url":"https://api.github.com/repos/ClusterHQ/flocker","forks_url":"https://api.github.com/repos/ClusterHQ/flocker/forks","keys_url":"https://api.github.com/repos/ClusterHQ/flocker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ClusterHQ/flocker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ClusterHQ/flocker/teams","hooks_url":"https://api.github.com/repos/ClusterHQ/flocker/hooks","issue_events_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/events{/number}","events_url":"https://api.github.com/repos/ClusterHQ/flocker/events","assignees_url":"https://api.github.com/repos/ClusterHQ/flocker/assignees{/user}","branches_url":"https://api.github.com/repos/ClusterHQ/flocker/branches{/branch}","tags_url":"https://api.github.com/repos/ClusterHQ/flocker/tags","blobs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ClusterHQ/flocker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/refs{/sha}","trees_url":"https://api.github.com/repos/ClusterHQ/flocker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/{sha}","languages_url":"https://api.github.com/repos/ClusterHQ/flocker/languages","stargazers_url":"https://api.github.com/repos/ClusterHQ/flocker/stargazers","contributors_url":"https://api.github.com/repos/ClusterHQ/flocker/contributors","subscribers_url":"https://api.github.com/repos/ClusterHQ/flocker/subscribers","subscription_url":"https://api.github.com/repos/ClusterHQ/flocker/subscription","commits_url":"https://api.github.com/repos/ClusterHQ/flocker/commits{/sha}","git_commits_url":"https://api.github.com/repos/ClusterHQ/flocker/git/commits{/sha}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/comments{/number}","issue_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/comments/{number}","contents_url":"https://api.github.com/repos/ClusterHQ/flocker/contents/{+path}","compare_url":"https://api.github.com/repos/ClusterHQ/flocker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ClusterHQ/flocker/merges","archive_url":"https://api.github.com/repos/ClusterHQ/flocker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ClusterHQ/flocker/downloads","issues_url":"https://api.github.com/repos/ClusterHQ/flocker/issues{/number}","pulls_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls{/number}","milestones_url":"https://api.github.com/repos/ClusterHQ/flocker/milestones{/number}","notifications_url":"https://api.github.com/repos/ClusterHQ/flocker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ClusterHQ/flocker/labels{/name}","releases_url":"https://api.github.com/repos/ClusterHQ/flocker/releases{/id}","created_at":"2014-04-28T18:02:14Z","updated_at":"2015-02-15T17:38:22Z","pushed_at":"2015-02-16T11:57:27Z","git_url":"git://github.com/ClusterHQ/flocker.git","ssh_url":"git@github.com:ClusterHQ/flocker.git","clone_url":"https://github.com/ClusterHQ/flocker.git","svn_url":"https://github.com/ClusterHQ/flocker","homepage":"https://clusterhq.com","size":39122,"stargazers_count":1187,"watchers_count":1187,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":20,"forks":58,"open_issues":20,"watchers":1187,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1156"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1156"},"issue":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1156"},"comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1156/comments"},"review_comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1156/comments"},"review_comment":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1156/commits"},"statuses":{"href":"https://api.github.com/repos/ClusterHQ/flocker/statuses/251847100be31ba5a34d2a73b7f81e6f2b5845c3"}}}}