{"action":"created","comment":{"url":"https://api.github.com/repos/thesharp/daemonize/pulls/comments/54140075","id":54140075,"diff_hunk":"@@ -118,4 +119,8 @@ def start(self):\n \n         self.logger.warn(\"Starting daemon.\")\n \n-        self.action()\n+        try:\n+            self.action()\n+        except Exception, e:\n+            for line in traceback.format_exc(e):","path":"daemonize.py","position":16,"original_position":16,"commit_id":"f295e3925a11599fdf53273f1d8ccf7b23429477","original_commit_id":"f295e3925a11599fdf53273f1d8ccf7b23429477","user":{"login":"knsd","id":613511,"avatar_url":"https://avatars.githubusercontent.com/u/613511?v=3","gravatar_id":"","url":"https://api.github.com/users/knsd","html_url":"https://github.com/knsd","followers_url":"https://api.github.com/users/knsd/followers","following_url":"https://api.github.com/users/knsd/following{/other_user}","gists_url":"https://api.github.com/users/knsd/gists{/gist_id}","starred_url":"https://api.github.com/users/knsd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knsd/subscriptions","organizations_url":"https://api.github.com/users/knsd/orgs","repos_url":"https://api.github.com/users/knsd/repos","events_url":"https://api.github.com/users/knsd/events{/privacy}","received_events_url":"https://api.github.com/users/knsd/received_events","type":"User","site_admin":false},"body":"As far as I can remember `traceback.format_exc` returns string instead of list of string, so this code will log every single character of traceback in a separate line.","created_at":"2016-02-25T18:27:05Z","updated_at":"2016-02-25T18:27:05Z","html_url":"https://github.com/thesharp/daemonize/pull/45#discussion_r54140075","pull_request_url":"https://api.github.com/repos/thesharp/daemonize/pulls/45","_links":{"self":{"href":"https://api.github.com/repos/thesharp/daemonize/pulls/comments/54140075"},"html":{"href":"https://github.com/thesharp/daemonize/pull/45#discussion_r54140075"},"pull_request":{"href":"https://api.github.com/repos/thesharp/daemonize/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/thesharp/daemonize/pulls/45","id":60713103,"html_url":"https://github.com/thesharp/daemonize/pull/45","diff_url":"https://github.com/thesharp/daemonize/pull/45.diff","patch_url":"https://github.com/thesharp/daemonize/pull/45.patch","issue_url":"https://api.github.com/repos/thesharp/daemonize/issues/45","number":45,"state":"open","locked":false,"title":"exceptions in the action kill the daemon but don't show up in the log","user":{"login":"akesterson","id":571882,"avatar_url":"https://avatars.githubusercontent.com/u/571882?v=3","gravatar_id":"","url":"https://api.github.com/users/akesterson","html_url":"https://github.com/akesterson","followers_url":"https://api.github.com/users/akesterson/followers","following_url":"https://api.github.com/users/akesterson/following{/other_user}","gists_url":"https://api.github.com/users/akesterson/gists{/gist_id}","starred_url":"https://api.github.com/users/akesterson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akesterson/subscriptions","organizations_url":"https://api.github.com/users/akesterson/orgs","repos_url":"https://api.github.com/users/akesterson/repos","events_url":"https://api.github.com/users/akesterson/events{/privacy}","received_events_url":"https://api.github.com/users/akesterson/received_events","type":"User","site_admin":false},"body":"I first found this in daemonize 2.3.1 on Oracle Linux on Python 2.6.\r\n\r\nIf you pass daemonize an action that throws an exception, it will cause the daemonize thread to exit. The log will contain no messages other than \"WARNING Stopping daemon\", rather than the log message from a signal handler, so I'm not really sure what's going on re: how that exception is being passed up through daemonize's code.\r\n\r\nWhat I DO know is that the exception (from the action) is not logged at all, and that makes troubleshooting daemons who fail in this way positively infuriating - in fact, it makes troubleshooting them basically impossible. To be fair, there's nothing that daemonize can reasonably *DO* with that exception; it's a daemon thread, so there's no choice but to exit when this happens. This pull ensures that, at the very least, the exception gets sent to the logger for the user to troubleshoot.","created_at":"2016-02-25T17:09:59Z","updated_at":"2016-02-25T18:27:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thesharp/daemonize/pulls/45/commits","review_comments_url":"https://api.github.com/repos/thesharp/daemonize/pulls/45/comments","review_comment_url":"https://api.github.com/repos/thesharp/daemonize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thesharp/daemonize/issues/45/comments","statuses_url":"https://api.github.com/repos/thesharp/daemonize/statuses/f295e3925a11599fdf53273f1d8ccf7b23429477","head":{"label":"akesterson:master","ref":"master","sha":"f295e3925a11599fdf53273f1d8ccf7b23429477","user":{"login":"akesterson","id":571882,"avatar_url":"https://avatars.githubusercontent.com/u/571882?v=3","gravatar_id":"","url":"https://api.github.com/users/akesterson","html_url":"https://github.com/akesterson","followers_url":"https://api.github.com/users/akesterson/followers","following_url":"https://api.github.com/users/akesterson/following{/other_user}","gists_url":"https://api.github.com/users/akesterson/gists{/gist_id}","starred_url":"https://api.github.com/users/akesterson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akesterson/subscriptions","organizations_url":"https://api.github.com/users/akesterson/orgs","repos_url":"https://api.github.com/users/akesterson/repos","events_url":"https://api.github.com/users/akesterson/events{/privacy}","received_events_url":"https://api.github.com/users/akesterson/received_events","type":"User","site_admin":false},"repo":{"id":15553120,"name":"daemonize","full_name":"akesterson/daemonize","owner":{"login":"akesterson","id":571882,"avatar_url":"https://avatars.githubusercontent.com/u/571882?v=3","gravatar_id":"","url":"https://api.github.com/users/akesterson","html_url":"https://github.com/akesterson","followers_url":"https://api.github.com/users/akesterson/followers","following_url":"https://api.github.com/users/akesterson/following{/other_user}","gists_url":"https://api.github.com/users/akesterson/gists{/gist_id}","starred_url":"https://api.github.com/users/akesterson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akesterson/subscriptions","organizations_url":"https://api.github.com/users/akesterson/orgs","repos_url":"https://api.github.com/users/akesterson/repos","events_url":"https://api.github.com/users/akesterson/events{/privacy}","received_events_url":"https://api.github.com/users/akesterson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/akesterson/daemonize","description":"daemonize is a library for writing system daemons in Python.","fork":true,"url":"https://api.github.com/repos/akesterson/daemonize","forks_url":"https://api.github.com/repos/akesterson/daemonize/forks","keys_url":"https://api.github.com/repos/akesterson/daemonize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akesterson/daemonize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akesterson/daemonize/teams","hooks_url":"https://api.github.com/repos/akesterson/daemonize/hooks","issue_events_url":"https://api.github.com/repos/akesterson/daemonize/issues/events{/number}","events_url":"https://api.github.com/repos/akesterson/daemonize/events","assignees_url":"https://api.github.com/repos/akesterson/daemonize/assignees{/user}","branches_url":"https://api.github.com/repos/akesterson/daemonize/branches{/branch}","tags_url":"https://api.github.com/repos/akesterson/daemonize/tags","blobs_url":"https://api.github.com/repos/akesterson/daemonize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akesterson/daemonize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akesterson/daemonize/git/refs{/sha}","trees_url":"https://api.github.com/repos/akesterson/daemonize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akesterson/daemonize/statuses/{sha}","languages_url":"https://api.github.com/repos/akesterson/daemonize/languages","stargazers_url":"https://api.github.com/repos/akesterson/daemonize/stargazers","contributors_url":"https://api.github.com/repos/akesterson/daemonize/contributors","subscribers_url":"https://api.github.com/repos/akesterson/daemonize/subscribers","subscription_url":"https://api.github.com/repos/akesterson/daemonize/subscription","commits_url":"https://api.github.com/repos/akesterson/daemonize/commits{/sha}","git_commits_url":"https://api.github.com/repos/akesterson/daemonize/git/commits{/sha}","comments_url":"https://api.github.com/repos/akesterson/daemonize/comments{/number}","issue_comment_url":"https://api.github.com/repos/akesterson/daemonize/issues/comments{/number}","contents_url":"https://api.github.com/repos/akesterson/daemonize/contents/{+path}","compare_url":"https://api.github.com/repos/akesterson/daemonize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akesterson/daemonize/merges","archive_url":"https://api.github.com/repos/akesterson/daemonize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akesterson/daemonize/downloads","issues_url":"https://api.github.com/repos/akesterson/daemonize/issues{/number}","pulls_url":"https://api.github.com/repos/akesterson/daemonize/pulls{/number}","milestones_url":"https://api.github.com/repos/akesterson/daemonize/milestones{/number}","notifications_url":"https://api.github.com/repos/akesterson/daemonize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akesterson/daemonize/labels{/name}","releases_url":"https://api.github.com/repos/akesterson/daemonize/releases{/id}","deployments_url":"https://api.github.com/repos/akesterson/daemonize/deployments","created_at":"2013-12-31T16:33:42Z","updated_at":"2016-02-25T17:03:40Z","pushed_at":"2016-02-25T17:03:55Z","git_url":"git://github.com/akesterson/daemonize.git","ssh_url":"git@github.com:akesterson/daemonize.git","clone_url":"https://github.com/akesterson/daemonize.git","svn_url":"https://github.com/akesterson/daemonize","homepage":"","size":27,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"thesharp:master","ref":"master","sha":"29ec27dbbec8fdb5a757ae6f588baa347f515b01","user":{"login":"thesharp","id":1151162,"avatar_url":"https://avatars.githubusercontent.com/u/1151162?v=3","gravatar_id":"","url":"https://api.github.com/users/thesharp","html_url":"https://github.com/thesharp","followers_url":"https://api.github.com/users/thesharp/followers","following_url":"https://api.github.com/users/thesharp/following{/other_user}","gists_url":"https://api.github.com/users/thesharp/gists{/gist_id}","starred_url":"https://api.github.com/users/thesharp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thesharp/subscriptions","organizations_url":"https://api.github.com/users/thesharp/orgs","repos_url":"https://api.github.com/users/thesharp/repos","events_url":"https://api.github.com/users/thesharp/events{/privacy}","received_events_url":"https://api.github.com/users/thesharp/received_events","type":"User","site_admin":false},"repo":{"id":3722317,"name":"daemonize","full_name":"thesharp/daemonize","owner":{"login":"thesharp","id":1151162,"avatar_url":"https://avatars.githubusercontent.com/u/1151162?v=3","gravatar_id":"","url":"https://api.github.com/users/thesharp","html_url":"https://github.com/thesharp","followers_url":"https://api.github.com/users/thesharp/followers","following_url":"https://api.github.com/users/thesharp/following{/other_user}","gists_url":"https://api.github.com/users/thesharp/gists{/gist_id}","starred_url":"https://api.github.com/users/thesharp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thesharp/subscriptions","organizations_url":"https://api.github.com/users/thesharp/orgs","repos_url":"https://api.github.com/users/thesharp/repos","events_url":"https://api.github.com/users/thesharp/events{/privacy}","received_events_url":"https://api.github.com/users/thesharp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thesharp/daemonize","description":"daemonize is a library for writing system daemons in Python.","fork":false,"url":"https://api.github.com/repos/thesharp/daemonize","forks_url":"https://api.github.com/repos/thesharp/daemonize/forks","keys_url":"https://api.github.com/repos/thesharp/daemonize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thesharp/daemonize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thesharp/daemonize/teams","hooks_url":"https://api.github.com/repos/thesharp/daemonize/hooks","issue_events_url":"https://api.github.com/repos/thesharp/daemonize/issues/events{/number}","events_url":"https://api.github.com/repos/thesharp/daemonize/events","assignees_url":"https://api.github.com/repos/thesharp/daemonize/assignees{/user}","branches_url":"https://api.github.com/repos/thesharp/daemonize/branches{/branch}","tags_url":"https://api.github.com/repos/thesharp/daemonize/tags","blobs_url":"https://api.github.com/repos/thesharp/daemonize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thesharp/daemonize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thesharp/daemonize/git/refs{/sha}","trees_url":"https://api.github.com/repos/thesharp/daemonize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thesharp/daemonize/statuses/{sha}","languages_url":"https://api.github.com/repos/thesharp/daemonize/languages","stargazers_url":"https://api.github.com/repos/thesharp/daemonize/stargazers","contributors_url":"https://api.github.com/repos/thesharp/daemonize/contributors","subscribers_url":"https://api.github.com/repos/thesharp/daemonize/subscribers","subscription_url":"https://api.github.com/repos/thesharp/daemonize/subscription","commits_url":"https://api.github.com/repos/thesharp/daemonize/commits{/sha}","git_commits_url":"https://api.github.com/repos/thesharp/daemonize/git/commits{/sha}","comments_url":"https://api.github.com/repos/thesharp/daemonize/comments{/number}","issue_comment_url":"https://api.github.com/repos/thesharp/daemonize/issues/comments{/number}","contents_url":"https://api.github.com/repos/thesharp/daemonize/contents/{+path}","compare_url":"https://api.github.com/repos/thesharp/daemonize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thesharp/daemonize/merges","archive_url":"https://api.github.com/repos/thesharp/daemonize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thesharp/daemonize/downloads","issues_url":"https://api.github.com/repos/thesharp/daemonize/issues{/number}","pulls_url":"https://api.github.com/repos/thesharp/daemonize/pulls{/number}","milestones_url":"https://api.github.com/repos/thesharp/daemonize/milestones{/number}","notifications_url":"https://api.github.com/repos/thesharp/daemonize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thesharp/daemonize/labels{/name}","releases_url":"https://api.github.com/repos/thesharp/daemonize/releases{/id}","deployments_url":"https://api.github.com/repos/thesharp/daemonize/deployments","created_at":"2012-03-14T21:03:20Z","updated_at":"2016-02-23T15:51:00Z","pushed_at":"2016-02-25T17:09:59Z","git_url":"git://github.com/thesharp/daemonize.git","ssh_url":"git@github.com:thesharp/daemonize.git","clone_url":"https://github.com/thesharp/daemonize.git","svn_url":"https://github.com/thesharp/daemonize","homepage":"","size":88,"stargazers_count":112,"watchers_count":112,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":7,"forks":27,"open_issues":7,"watchers":112,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thesharp/daemonize/pulls/45"},"html":{"href":"https://github.com/thesharp/daemonize/pull/45"},"issue":{"href":"https://api.github.com/repos/thesharp/daemonize/issues/45"},"comments":{"href":"https://api.github.com/repos/thesharp/daemonize/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/thesharp/daemonize/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/thesharp/daemonize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thesharp/daemonize/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/thesharp/daemonize/statuses/f295e3925a11599fdf53273f1d8ccf7b23429477"}}}}