{"action":"created","comment":{"url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/comments/43190657","id":43190657,"diff_hunk":"@@ -726,15 +728,55 @@ def run_protected():\n     \"\"\"\n     Runs the plugin, intercepting all exceptions.\n     \"\"\"\n-    # Configure logging\n-    configure_logger(logger, LOG_LEVEL, True)\n-    configure_logger(pycalico_logger, LOG_LEVEL, False)\n+    # Parse arguments and configure logging\n+    global logger\n+    mode = sys.argv[1]\n+\n+    # Append a stdout logging handler to log to the Kubelet.\n+    # We cannot do this in the status hook because the Kubelet looks to\n+    # stdout for status results.\n+    if mode != 'status':\n+        configure_stdout_logger(logger=logger,\n+                                log_level=logging.INFO,\n+                                root_logger=True)\n+        configure_stdout_logger(logger=pycalico_logger,\n+                                log_level=logging.INFO,\n+                                root_logger=False)\n+\n+    # Adapt the logger to append the Docker ID to logs.\n+    # Docker ID is not supplied in `init`, so do not include the it in logs.\n+    if mode != 'init':\n+        namespace = sys.argv[2].replace('/', '_')\n+        pod_name = sys.argv[3].replace('/', '_')\n+        docker_id = sys.argv[4]\n+\n+        configure_logger(logger=logger,\n+                         log_level=LOG_LEVEL,\n+                         log_format=DOCKER_ID_ROOT_LOG_FORMAT)\n+        configure_logger(logger=pycalico_logger,\n+                         log_level=LOG_LEVEL,\n+                         log_format=DOCKER_ID_LOG_FORMAT)\n+\n+        logger = logging.LoggerAdapter(logger, {'docker_id': str(docker_id)[:12]})\n+        logger = logging.LoggerAdapter(pycalico_logger, {'docker_id': str(docker_id)[:12]})","path":"calico_kubernetes/calico_kubernetes.py","position":67,"original_position":67,"commit_id":"50f0b2d4f9595b36a51b28d6999b58a135eb11ec","original_commit_id":"50f0b2d4f9595b36a51b28d6999b58a135eb11ec","user":{"login":"alexhersh","id":3424115,"avatar_url":"https://avatars.githubusercontent.com/u/3424115?v=3","gravatar_id":"","url":"https://api.github.com/users/alexhersh","html_url":"https://github.com/alexhersh","followers_url":"https://api.github.com/users/alexhersh/followers","following_url":"https://api.github.com/users/alexhersh/following{/other_user}","gists_url":"https://api.github.com/users/alexhersh/gists{/gist_id}","starred_url":"https://api.github.com/users/alexhersh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexhersh/subscriptions","organizations_url":"https://api.github.com/users/alexhersh/orgs","repos_url":"https://api.github.com/users/alexhersh/repos","events_url":"https://api.github.com/users/alexhersh/events{/privacy}","received_events_url":"https://api.github.com/users/alexhersh/received_events","type":"User","site_admin":false},"body":"true!","created_at":"2015-10-27T21:32:14Z","updated_at":"2015-10-27T21:32:14Z","html_url":"https://github.com/projectcalico/calico-kubernetes/pull/77#discussion_r43190657","pull_request_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/77","_links":{"self":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/comments/43190657"},"html":{"href":"https://github.com/projectcalico/calico-kubernetes/pull/77#discussion_r43190657"},"pull_request":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/77"}}},"pull_request":{"url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/77","id":48262212,"html_url":"https://github.com/projectcalico/calico-kubernetes/pull/77","diff_url":"https://github.com/projectcalico/calico-kubernetes/pull/77.diff","patch_url":"https://github.com/projectcalico/calico-kubernetes/pull/77.patch","issue_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/77","number":77,"state":"open","locked":false,"title":"Append Docker ID to logging messages","user":{"login":"alexhersh","id":3424115,"avatar_url":"https://avatars.githubusercontent.com/u/3424115?v=3","gravatar_id":"","url":"https://api.github.com/users/alexhersh","html_url":"https://github.com/alexhersh","followers_url":"https://api.github.com/users/alexhersh/followers","following_url":"https://api.github.com/users/alexhersh/following{/other_user}","gists_url":"https://api.github.com/users/alexhersh/gists{/gist_id}","starred_url":"https://api.github.com/users/alexhersh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexhersh/subscriptions","organizations_url":"https://api.github.com/users/alexhersh/orgs","repos_url":"https://api.github.com/users/alexhersh/repos","events_url":"https://api.github.com/users/alexhersh/events{/privacy}","received_events_url":"https://api.github.com/users/alexhersh/received_events","type":"User","site_admin":false},"body":"+ Fix #72\r\n+ Use custom LoggerAdapter class to update the logger object with processed message after docker_id has been found.","created_at":"2015-10-20T21:44:16Z","updated_at":"2015-10-27T21:32:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea317003b9155c065d5c2d420248cd88b501527e","assignee":{"login":"Symmetric","id":1524910,"avatar_url":"https://avatars.githubusercontent.com/u/1524910?v=3","gravatar_id":"","url":"https://api.github.com/users/Symmetric","html_url":"https://github.com/Symmetric","followers_url":"https://api.github.com/users/Symmetric/followers","following_url":"https://api.github.com/users/Symmetric/following{/other_user}","gists_url":"https://api.github.com/users/Symmetric/gists{/gist_id}","starred_url":"https://api.github.com/users/Symmetric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Symmetric/subscriptions","organizations_url":"https://api.github.com/users/Symmetric/orgs","repos_url":"https://api.github.com/users/Symmetric/repos","events_url":"https://api.github.com/users/Symmetric/events{/privacy}","received_events_url":"https://api.github.com/users/Symmetric/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/77/commits","review_comments_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/77/comments","review_comment_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/77/comments","statuses_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/statuses/50f0b2d4f9595b36a51b28d6999b58a135eb11ec","head":{"label":"alexhersh:logID","ref":"logID","sha":"50f0b2d4f9595b36a51b28d6999b58a135eb11ec","user":{"login":"alexhersh","id":3424115,"avatar_url":"https://avatars.githubusercontent.com/u/3424115?v=3","gravatar_id":"","url":"https://api.github.com/users/alexhersh","html_url":"https://github.com/alexhersh","followers_url":"https://api.github.com/users/alexhersh/followers","following_url":"https://api.github.com/users/alexhersh/following{/other_user}","gists_url":"https://api.github.com/users/alexhersh/gists{/gist_id}","starred_url":"https://api.github.com/users/alexhersh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexhersh/subscriptions","organizations_url":"https://api.github.com/users/alexhersh/orgs","repos_url":"https://api.github.com/users/alexhersh/repos","events_url":"https://api.github.com/users/alexhersh/events{/privacy}","received_events_url":"https://api.github.com/users/alexhersh/received_events","type":"User","site_admin":false},"repo":{"id":40028230,"name":"calico-kubernetes","full_name":"alexhersh/calico-kubernetes","owner":{"login":"alexhersh","id":3424115,"avatar_url":"https://avatars.githubusercontent.com/u/3424115?v=3","gravatar_id":"","url":"https://api.github.com/users/alexhersh","html_url":"https://github.com/alexhersh","followers_url":"https://api.github.com/users/alexhersh/followers","following_url":"https://api.github.com/users/alexhersh/following{/other_user}","gists_url":"https://api.github.com/users/alexhersh/gists{/gist_id}","starred_url":"https://api.github.com/users/alexhersh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexhersh/subscriptions","organizations_url":"https://api.github.com/users/alexhersh/orgs","repos_url":"https://api.github.com/users/alexhersh/repos","events_url":"https://api.github.com/users/alexhersh/events{/privacy}","received_events_url":"https://api.github.com/users/alexhersh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexhersh/calico-kubernetes","description":"","fork":true,"url":"https://api.github.com/repos/alexhersh/calico-kubernetes","forks_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/forks","keys_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/teams","hooks_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/hooks","issue_events_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/events","assignees_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/tags","blobs_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/languages","stargazers_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/stargazers","contributors_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/contributors","subscribers_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/subscribers","subscription_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/subscription","commits_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/merges","archive_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/downloads","issues_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/alexhersh/calico-kubernetes/releases{/id}","created_at":"2015-07-31T23:05:02Z","updated_at":"2015-07-31T23:05:04Z","pushed_at":"2015-10-27T17:08:51Z","git_url":"git://github.com/alexhersh/calico-kubernetes.git","ssh_url":"git@github.com:alexhersh/calico-kubernetes.git","clone_url":"https://github.com/alexhersh/calico-kubernetes.git","svn_url":"https://github.com/alexhersh/calico-kubernetes","homepage":null,"size":484,"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":"projectcalico:master","ref":"master","sha":"4de37a60ee4c8050b190ef65af5f595a073bf1bd","user":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars.githubusercontent.com/u/12304728?v=3","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"repo":{"id":39913632,"name":"calico-kubernetes","full_name":"projectcalico/calico-kubernetes","owner":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars.githubusercontent.com/u/12304728?v=3","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectcalico/calico-kubernetes","description":"Calico Kubernetes Networking Plugin","fork":false,"url":"https://api.github.com/repos/projectcalico/calico-kubernetes","forks_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/forks","keys_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/teams","hooks_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/hooks","issue_events_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/events","assignees_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/tags","blobs_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/languages","stargazers_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/stargazers","contributors_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/contributors","subscribers_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/subscribers","subscription_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/subscription","commits_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/merges","archive_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/downloads","issues_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/releases{/id}","created_at":"2015-07-29T20:04:46Z","updated_at":"2015-10-12T22:47:45Z","pushed_at":"2015-10-27T18:39:54Z","git_url":"git://github.com/projectcalico/calico-kubernetes.git","ssh_url":"git@github.com:projectcalico/calico-kubernetes.git","clone_url":"https://github.com/projectcalico/calico-kubernetes.git","svn_url":"https://github.com/projectcalico/calico-kubernetes","homepage":"","size":843,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":16,"forks":4,"open_issues":16,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/77"},"html":{"href":"https://github.com/projectcalico/calico-kubernetes/pull/77"},"issue":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/77"},"comments":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/77/comments"},"review_comments":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/77/comments"},"review_comment":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/77/commits"},"statuses":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/statuses/50f0b2d4f9595b36a51b28d6999b58a135eb11ec"}}}}