{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/core-setup/pulls/comments/215080666","pull_request_review_id":152269102,"id":215080666,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTA4MDY2Ng==","diff_hunk":"@@ -0,0 +1,74 @@\n+# Host tracing\n+\n+The various .NET Core host components provide detailed tracing of diagnostic information which can help solve issues around runtime, framework and assembly resolution and others.  \n+\n+## Existing support\n+Currently (as of .NET Core 2.1) the host tracing is only written to the `stderr` output of the process. It can be turned on by setting `COREHOST_TRACE=1`.\n+\n+## Proposed changes\n+For .NET Core 3 the proposal is to keep the existing behavior as described above and add two additional ways to capture the tracing:\n+* Redirect the trace to a file instead - this would be done by setting `COREHOST_TRACE=1` and also `COREHOST_TRACEFILE=<path>` in the environment for the process.\n+* For custom host support a way to capture the trace output in code. This will be done by adding `*_set_trace_listener` functions to `hostfxr` and `hostpolicy` which would let the custom host intercept all tracing.\n+\n+## Components involved\n+Host tracing spans various components:\n+* `dotnet` or `apphost` executable\n+* `hostfxr` library\n+* `hostpolicy` library\n+\n+If a custom host is used it will typically replace the executables and possible even some of the libraries. The custom host can use either `hostfx` or `hostpolicy` directly. So each of these components must support tracing on its own along with the configuration. In case several of these components are used together, they must cooperate and \"share\" the tracing setup.\n+\n+Currently (as of .NET Core 2.1) all these components include the same code for tracing but act completely independently. VIa the fact that they share the same code, the end behavior is that they all write their trace output to the same location `stderr`. The only synchronization currently implemented is that each component fully flushes all internal tracing buffers before transferring control to a different component.\n+\n+## New trace routing\n+By default tracing is disabled and is not routed anywhere. If it's enabled it is routed through an instance of `host_trace_listener` interface.\n+``` C++\n+struct host_trace_listener\n+{\n+    void trace_verbose(const pal::char_t *message);\n+    void trace_info(const pal::char_t *message);\n+    void trace_warning(const pal::char_t *message);\n+    void trace_error(const pal::char_t *message);\n+    void flush();\n+}\n+```\n+\n+The `message` parameter is a standard `NUL` terminated string.\n+\n+The host components provide two built in implementations of this interface:\n+* `stderr_trace_listener` which implements the .NET Core 2.1 behavior of routing tracing to the `stderr` output of the process. This is the default listener which is activated by setting `COREHOST_TRACE=1` environment variable.\n+* `file_trace_listener` which routes tracing into a file. This listener is activated by setting the `COREHOST_TRACE=1` and also providing the full path to the trace file in `COREHOST_TRACEFILE=<path>` environment variable.\n+\n+Custom host can provide its own implementation of `host_trace_listener` by calling:\n+``` C++\n+void hostfxr_set_trace_listener(host_trace_listener* listener)\n+```\n+from the `hostfxr` component or\n+``` C++\n+void corehost_set_trace_listener(host_trace_listener* listener)\n+```\n+from the `hostpolicy` component.\n+\n+The functions behave exactly the same in both components. The `listener` parameter can be:\n+* a pointer to an implementation of `host_trace_listener` which is then registered the only listener for all tracing.\n+* `NULL` value which unregisters any previously registered listener. After this call tracing is disabled.\n+\n+Custom host can and should register the trace listener as the first thing it does with the respective host component to ensure that all tracing is routed to it.  \n+\n+Only one trace listener can be registered at any given time.  ","path":"Documentation/design-docs/host-tracing.md","position":58,"original_position":58,"commit_id":"dc93bea6efad142a10692284afba301841254d3d","original_commit_id":"dc93bea6efad142a10692284afba301841254d3d","user":{"login":"steveharter","id":6986755,"node_id":"MDQ6VXNlcjY5ODY3NTU=","avatar_url":"https://avatars0.githubusercontent.com/u/6986755?v=4","gravatar_id":"","url":"https://api.github.com/users/steveharter","html_url":"https://github.com/steveharter","followers_url":"https://api.github.com/users/steveharter/followers","following_url":"https://api.github.com/users/steveharter/following{/other_user}","gists_url":"https://api.github.com/users/steveharter/gists{/gist_id}","starred_url":"https://api.github.com/users/steveharter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveharter/subscriptions","organizations_url":"https://api.github.com/users/steveharter/orgs","repos_url":"https://api.github.com/users/steveharter/repos","events_url":"https://api.github.com/users/steveharter/events{/privacy}","received_events_url":"https://api.github.com/users/steveharter/received_events","type":"User","site_admin":false},"body":"So if there is a trace listener, then no output to file and not output to stderr. Correct?\r\n\r\nA potential concern down the road is that the host tests currently use tracing to verify behavior, so it a test wishes to verify a custom ASPNET host (for example) it won't get the stderr messages since ASPNET will likely have it's own listener.","created_at":"2018-09-04T22:00:44Z","updated_at":"2018-09-04T22:07:21Z","html_url":"https://github.com/dotnet/core-setup/pull/4531#discussion_r215080666","pull_request_url":"https://api.github.com/repos/dotnet/core-setup/pulls/4531","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/core-setup/pulls/comments/215080666"},"html":{"href":"https://github.com/dotnet/core-setup/pull/4531#discussion_r215080666"},"pull_request":{"href":"https://api.github.com/repos/dotnet/core-setup/pulls/4531"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/core-setup/pulls/4531","id":212771269,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyNzcxMjY5","html_url":"https://github.com/dotnet/core-setup/pull/4531","diff_url":"https://github.com/dotnet/core-setup/pull/4531.diff","patch_url":"https://github.com/dotnet/core-setup/pull/4531.patch","issue_url":"https://api.github.com/repos/dotnet/core-setup/issues/4531","number":4531,"state":"open","locked":false,"title":"Proposal for improvements of host tracing in .NET Core 3","user":{"login":"vitek-karas","id":10670590,"node_id":"MDQ6VXNlcjEwNjcwNTkw","avatar_url":"https://avatars2.githubusercontent.com/u/10670590?v=4","gravatar_id":"","url":"https://api.github.com/users/vitek-karas","html_url":"https://github.com/vitek-karas","followers_url":"https://api.github.com/users/vitek-karas/followers","following_url":"https://api.github.com/users/vitek-karas/following{/other_user}","gists_url":"https://api.github.com/users/vitek-karas/gists{/gist_id}","starred_url":"https://api.github.com/users/vitek-karas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitek-karas/subscriptions","organizations_url":"https://api.github.com/users/vitek-karas/orgs","repos_url":"https://api.github.com/users/vitek-karas/repos","events_url":"https://api.github.com/users/vitek-karas/events{/privacy}","received_events_url":"https://api.github.com/users/vitek-karas/received_events","type":"User","site_admin":false},"body":"This is related to #4455 ","created_at":"2018-09-03T14:52:27Z","updated_at":"2018-09-04T22:07:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a7336970141f18a8e10632d5d0555b7a980f0205","assignee":null,"assignees":[],"requested_reviewers":[{"login":"swaroop-sridhar","id":8977622,"node_id":"MDQ6VXNlcjg5Nzc2MjI=","avatar_url":"https://avatars1.githubusercontent.com/u/8977622?v=4","gravatar_id":"","url":"https://api.github.com/users/swaroop-sridhar","html_url":"https://github.com/swaroop-sridhar","followers_url":"https://api.github.com/users/swaroop-sridhar/followers","following_url":"https://api.github.com/users/swaroop-sridhar/following{/other_user}","gists_url":"https://api.github.com/users/swaroop-sridhar/gists{/gist_id}","starred_url":"https://api.github.com/users/swaroop-sridhar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swaroop-sridhar/subscriptions","organizations_url":"https://api.github.com/users/swaroop-sridhar/orgs","repos_url":"https://api.github.com/users/swaroop-sridhar/repos","events_url":"https://api.github.com/users/swaroop-sridhar/events{/privacy}","received_events_url":"https://api.github.com/users/swaroop-sridhar/received_events","type":"User","site_admin":false},{"login":"jeffschwMSFT","id":9561583,"node_id":"MDQ6VXNlcjk1NjE1ODM=","avatar_url":"https://avatars0.githubusercontent.com/u/9561583?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffschwMSFT","html_url":"https://github.com/jeffschwMSFT","followers_url":"https://api.github.com/users/jeffschwMSFT/followers","following_url":"https://api.github.com/users/jeffschwMSFT/following{/other_user}","gists_url":"https://api.github.com/users/jeffschwMSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffschwMSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffschwMSFT/subscriptions","organizations_url":"https://api.github.com/users/jeffschwMSFT/orgs","repos_url":"https://api.github.com/users/jeffschwMSFT/repos","events_url":"https://api.github.com/users/jeffschwMSFT/events{/privacy}","received_events_url":"https://api.github.com/users/jeffschwMSFT/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/core-setup/pulls/4531/commits","review_comments_url":"https://api.github.com/repos/dotnet/core-setup/pulls/4531/comments","review_comment_url":"https://api.github.com/repos/dotnet/core-setup/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/core-setup/issues/4531/comments","statuses_url":"https://api.github.com/repos/dotnet/core-setup/statuses/dc93bea6efad142a10692284afba301841254d3d","head":{"label":"vitek-karas:HostTracingDesign","ref":"HostTracingDesign","sha":"dc93bea6efad142a10692284afba301841254d3d","user":{"login":"vitek-karas","id":10670590,"node_id":"MDQ6VXNlcjEwNjcwNTkw","avatar_url":"https://avatars2.githubusercontent.com/u/10670590?v=4","gravatar_id":"","url":"https://api.github.com/users/vitek-karas","html_url":"https://github.com/vitek-karas","followers_url":"https://api.github.com/users/vitek-karas/followers","following_url":"https://api.github.com/users/vitek-karas/following{/other_user}","gists_url":"https://api.github.com/users/vitek-karas/gists{/gist_id}","starred_url":"https://api.github.com/users/vitek-karas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitek-karas/subscriptions","organizations_url":"https://api.github.com/users/vitek-karas/orgs","repos_url":"https://api.github.com/users/vitek-karas/repos","events_url":"https://api.github.com/users/vitek-karas/events{/privacy}","received_events_url":"https://api.github.com/users/vitek-karas/received_events","type":"User","site_admin":false},"repo":{"id":138876524,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg4NzY1MjQ=","name":"core-setup","full_name":"vitek-karas/core-setup","owner":{"login":"vitek-karas","id":10670590,"node_id":"MDQ6VXNlcjEwNjcwNTkw","avatar_url":"https://avatars2.githubusercontent.com/u/10670590?v=4","gravatar_id":"","url":"https://api.github.com/users/vitek-karas","html_url":"https://github.com/vitek-karas","followers_url":"https://api.github.com/users/vitek-karas/followers","following_url":"https://api.github.com/users/vitek-karas/following{/other_user}","gists_url":"https://api.github.com/users/vitek-karas/gists{/gist_id}","starred_url":"https://api.github.com/users/vitek-karas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitek-karas/subscriptions","organizations_url":"https://api.github.com/users/vitek-karas/orgs","repos_url":"https://api.github.com/users/vitek-karas/repos","events_url":"https://api.github.com/users/vitek-karas/events{/privacy}","received_events_url":"https://api.github.com/users/vitek-karas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vitek-karas/core-setup","description":"Installer packages for the .NET Core runtime and libraries","fork":true,"url":"https://api.github.com/repos/vitek-karas/core-setup","forks_url":"https://api.github.com/repos/vitek-karas/core-setup/forks","keys_url":"https://api.github.com/repos/vitek-karas/core-setup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vitek-karas/core-setup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vitek-karas/core-setup/teams","hooks_url":"https://api.github.com/repos/vitek-karas/core-setup/hooks","issue_events_url":"https://api.github.com/repos/vitek-karas/core-setup/issues/events{/number}","events_url":"https://api.github.com/repos/vitek-karas/core-setup/events","assignees_url":"https://api.github.com/repos/vitek-karas/core-setup/assignees{/user}","branches_url":"https://api.github.com/repos/vitek-karas/core-setup/branches{/branch}","tags_url":"https://api.github.com/repos/vitek-karas/core-setup/tags","blobs_url":"https://api.github.com/repos/vitek-karas/core-setup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vitek-karas/core-setup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vitek-karas/core-setup/git/refs{/sha}","trees_url":"https://api.github.com/repos/vitek-karas/core-setup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vitek-karas/core-setup/statuses/{sha}","languages_url":"https://api.github.com/repos/vitek-karas/core-setup/languages","stargazers_url":"https://api.github.com/repos/vitek-karas/core-setup/stargazers","contributors_url":"https://api.github.com/repos/vitek-karas/core-setup/contributors","subscribers_url":"https://api.github.com/repos/vitek-karas/core-setup/subscribers","subscription_url":"https://api.github.com/repos/vitek-karas/core-setup/subscription","commits_url":"https://api.github.com/repos/vitek-karas/core-setup/commits{/sha}","git_commits_url":"https://api.github.com/repos/vitek-karas/core-setup/git/commits{/sha}","comments_url":"https://api.github.com/repos/vitek-karas/core-setup/comments{/number}","issue_comment_url":"https://api.github.com/repos/vitek-karas/core-setup/issues/comments{/number}","contents_url":"https://api.github.com/repos/vitek-karas/core-setup/contents/{+path}","compare_url":"https://api.github.com/repos/vitek-karas/core-setup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vitek-karas/core-setup/merges","archive_url":"https://api.github.com/repos/vitek-karas/core-setup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vitek-karas/core-setup/downloads","issues_url":"https://api.github.com/repos/vitek-karas/core-setup/issues{/number}","pulls_url":"https://api.github.com/repos/vitek-karas/core-setup/pulls{/number}","milestones_url":"https://api.github.com/repos/vitek-karas/core-setup/milestones{/number}","notifications_url":"https://api.github.com/repos/vitek-karas/core-setup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vitek-karas/core-setup/labels{/name}","releases_url":"https://api.github.com/repos/vitek-karas/core-setup/releases{/id}","deployments_url":"https://api.github.com/repos/vitek-karas/core-setup/deployments","created_at":"2018-06-27T12:09:50Z","updated_at":"2018-09-03T06:56:35Z","pushed_at":"2018-09-04T20:28:29Z","git_url":"git://github.com/vitek-karas/core-setup.git","ssh_url":"git@github.com:vitek-karas/core-setup.git","clone_url":"https://github.com/vitek-karas/core-setup.git","svn_url":"https://github.com/vitek-karas/core-setup","homepage":"","size":6409,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"eab4b2fd162e453988af973878ddfa7eb9496a6b","user":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":59249196,"node_id":"MDEwOlJlcG9zaXRvcnk1OTI0OTE5Ng==","name":"core-setup","full_name":"dotnet/core-setup","owner":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/core-setup","description":"Installer packages for the .NET Core runtime and libraries","fork":false,"url":"https://api.github.com/repos/dotnet/core-setup","forks_url":"https://api.github.com/repos/dotnet/core-setup/forks","keys_url":"https://api.github.com/repos/dotnet/core-setup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/core-setup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/core-setup/teams","hooks_url":"https://api.github.com/repos/dotnet/core-setup/hooks","issue_events_url":"https://api.github.com/repos/dotnet/core-setup/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/core-setup/events","assignees_url":"https://api.github.com/repos/dotnet/core-setup/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/core-setup/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/core-setup/tags","blobs_url":"https://api.github.com/repos/dotnet/core-setup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/core-setup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/core-setup/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/core-setup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/core-setup/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/core-setup/languages","stargazers_url":"https://api.github.com/repos/dotnet/core-setup/stargazers","contributors_url":"https://api.github.com/repos/dotnet/core-setup/contributors","subscribers_url":"https://api.github.com/repos/dotnet/core-setup/subscribers","subscription_url":"https://api.github.com/repos/dotnet/core-setup/subscription","commits_url":"https://api.github.com/repos/dotnet/core-setup/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/core-setup/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/core-setup/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/core-setup/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/core-setup/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/core-setup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/core-setup/merges","archive_url":"https://api.github.com/repos/dotnet/core-setup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/core-setup/downloads","issues_url":"https://api.github.com/repos/dotnet/core-setup/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/core-setup/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/core-setup/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/core-setup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/core-setup/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/core-setup/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/core-setup/deployments","created_at":"2016-05-19T23:07:13Z","updated_at":"2018-09-04T18:11:26Z","pushed_at":"2018-09-04T20:28:30Z","git_url":"git://github.com/dotnet/core-setup.git","ssh_url":"git@github.com:dotnet/core-setup.git","clone_url":"https://github.com/dotnet/core-setup.git","svn_url":"https://github.com/dotnet/core-setup","homepage":"","size":6546,"stargazers_count":234,"watchers_count":234,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":152,"mirror_url":null,"archived":false,"open_issues_count":185,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":152,"open_issues":185,"watchers":234,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/core-setup/pulls/4531"},"html":{"href":"https://github.com/dotnet/core-setup/pull/4531"},"issue":{"href":"https://api.github.com/repos/dotnet/core-setup/issues/4531"},"comments":{"href":"https://api.github.com/repos/dotnet/core-setup/issues/4531/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/core-setup/pulls/4531/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/core-setup/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/core-setup/pulls/4531/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/core-setup/statuses/dc93bea6efad142a10692284afba301841254d3d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"steveharter"}}