{"action":"created","comment":{"url":"https://api.github.com/repos/apache/cordova-windows/pulls/comments/36398856","id":36398856,"diff_hunk":"@@ -0,0 +1,226 @@\n+/*\n+       Licensed to the Apache Software Foundation (ASF) under one\n+       or more contributor license agreements.  See the NOTICE file\n+       distributed with this work for additional information\n+       regarding copyright ownership.  The ASF licenses this file\n+       to you under the Apache License, Version 2.0 (the\n+       \"License\"); you may not use this file except in compliance\n+       with the License.  You may obtain a copy of the License at\n+\n+         http://www.apache.org/licenses/LICENSE-2.0\n+\n+       Unless required by applicable law or agreed to in writing,\n+       software distributed under the License is distributed on an\n+       \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+       KIND, either express or implied.  See the License for the\n+       specific language governing permissions and limitations\n+       under the License.\n+*/\n+\n+var path    = require('path'),\n+    et      = require('elementtree'),\n+    Q       = require('q'),\n+    cp      = require('child_process'),\n+    shelljs = require('shelljs');\n+\n+var appTracingLogInitialState = null,\n+    adminLogInitialState = null;\n+\n+/*\n+ * Gets windows AppHost/ApplicationTracing and AppHost/Admin logs\n+ * and prints them to console\n+ */\n+module.exports.run = function() {\n+    getLogState('Microsoft-Windows-AppHost/ApplicationTracing').then(function (state) {\n+        appTracingLogInitialState = state;\n+        return getLogState('Microsoft-Windows-AppHost/Admin');\n+    }).then(function(state) {\n+        adminLogInitialState = state;\n+        return enableLogging('Microsoft-Windows-AppHost/Admin');\n+    }).then(function () {\n+        return enableLogging('Microsoft-Windows-AppHost/ApplicationTracing');\n+    }).then(function () {\n+        console.log('Logging enabled, now printing logs. To stop, please press Ctrl+C once.');\n+        startLogging('Microsoft-Windows-AppHost/Admin');\n+        startLogging('Microsoft-Windows-AppHost/ApplicationTracing');\n+    }).catch(function (error) {\n+        console.error(error);\n+    });\n+\n+    // Disable logs before exiting\n+    process.on('exit', function () {\n+        if ((appTracingLogInitialState !== null) && !appTracingLogInitialState) {\n+            disableLogging('Microsoft-Windows-AppHost/ApplicationTracing');\n+        }\n+        if ((adminLogInitialState !== null) && !adminLogInitialState) {\n+            disableLogging('Microsoft-Windows-AppHost/Admin');\n+        }\n+    });\n+\n+    // Catch Ctrl+C event and exit gracefully\n+    process.on('SIGINT', function () {\n+        process.exit(2);\n+    });\n+\n+    // Catch uncaught exceptions, print trace, then exit gracefully\n+    process.on('uncaughtException', function(e) {\n+        console.log(e.stack);\n+        process.exit(99);\n+    });\n+};\n+\n+function startLogging(channel) {\n+    var startTime = new Date().toISOString();\n+    setInterval(function() {\n+        var command = 'wevtutil qe ' + channel + ' /q:\"*[System [(TimeCreated [@SystemTime>\\'' + startTime + '\\'])]]\" /e:root';","path":"template/cordova/lib/log.js","position":76,"original_position":75,"commit_id":"447f5036b708b3eba2165b29e81e19673503150c","original_commit_id":"58dd743150eac5234d54bb009d190fe3140e2447","user":{"login":"alsorokin","id":10210197,"avatar_url":"https://avatars.githubusercontent.com/u/10210197?v=3","gravatar_id":"","url":"https://api.github.com/users/alsorokin","html_url":"https://github.com/alsorokin","followers_url":"https://api.github.com/users/alsorokin/followers","following_url":"https://api.github.com/users/alsorokin/following{/other_user}","gists_url":"https://api.github.com/users/alsorokin/gists{/gist_id}","starred_url":"https://api.github.com/users/alsorokin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alsorokin/subscriptions","organizations_url":"https://api.github.com/users/alsorokin/orgs","repos_url":"https://api.github.com/users/alsorokin/repos","events_url":"https://api.github.com/users/alsorokin/events{/privacy}","received_events_url":"https://api.github.com/users/alsorokin/received_events","type":"User","site_admin":false},"body":"@robpaveza Actually, I just modified the script so that it wouldn't fail if it hasn't administrator privileges, but only warn about that and try to show the logs that are already enabled.","created_at":"2015-08-06T10:03:04Z","updated_at":"2015-08-06T10:03:04Z","html_url":"https://github.com/apache/cordova-windows/pull/107#discussion_r36398856","pull_request_url":"https://api.github.com/repos/apache/cordova-windows/pulls/107","_links":{"self":{"href":"https://api.github.com/repos/apache/cordova-windows/pulls/comments/36398856"},"html":{"href":"https://github.com/apache/cordova-windows/pull/107#discussion_r36398856"},"pull_request":{"href":"https://api.github.com/repos/apache/cordova-windows/pulls/107"}}},"pull_request":{"url":"https://api.github.com/repos/apache/cordova-windows/pulls/107","id":41589486,"html_url":"https://github.com/apache/cordova-windows/pull/107","diff_url":"https://github.com/apache/cordova-windows/pull/107.diff","patch_url":"https://github.com/apache/cordova-windows/pull/107.patch","issue_url":"https://api.github.com/repos/apache/cordova-windows/issues/107","number":107,"state":"open","locked":false,"title":"CB-8936 Added logging functionality","user":{"login":"alsorokin","id":10210197,"avatar_url":"https://avatars.githubusercontent.com/u/10210197?v=3","gravatar_id":"","url":"https://api.github.com/users/alsorokin","html_url":"https://github.com/alsorokin","followers_url":"https://api.github.com/users/alsorokin/followers","following_url":"https://api.github.com/users/alsorokin/following{/other_user}","gists_url":"https://api.github.com/users/alsorokin/gists{/gist_id}","starred_url":"https://api.github.com/users/alsorokin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alsorokin/subscriptions","organizations_url":"https://api.github.com/users/alsorokin/orgs","repos_url":"https://api.github.com/users/alsorokin/repos","events_url":"https://api.github.com/users/alsorokin/events{/privacy}","received_events_url":"https://api.github.com/users/alsorokin/received_events","type":"User","site_admin":false},"body":"https://issues.apache.org/jira/browse/CB-8936","created_at":"2015-08-04T16:29:39Z","updated_at":"2015-08-06T10:03:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ca2bf7619ade25fbf5706bca92b37e04eb65917","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/cordova-windows/pulls/107/commits","review_comments_url":"https://api.github.com/repos/apache/cordova-windows/pulls/107/comments","review_comment_url":"https://api.github.com/repos/apache/cordova-windows/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/cordova-windows/issues/107/comments","statuses_url":"https://api.github.com/repos/apache/cordova-windows/statuses/447f5036b708b3eba2165b29e81e19673503150c","head":{"label":"MSOpenTech:CB-8936","ref":"CB-8936","sha":"447f5036b708b3eba2165b29e81e19673503150c","user":{"login":"MSOpenTech","id":1638184,"avatar_url":"https://avatars.githubusercontent.com/u/1638184?v=3","gravatar_id":"","url":"https://api.github.com/users/MSOpenTech","html_url":"https://github.com/MSOpenTech","followers_url":"https://api.github.com/users/MSOpenTech/followers","following_url":"https://api.github.com/users/MSOpenTech/following{/other_user}","gists_url":"https://api.github.com/users/MSOpenTech/gists{/gist_id}","starred_url":"https://api.github.com/users/MSOpenTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSOpenTech/subscriptions","organizations_url":"https://api.github.com/users/MSOpenTech/orgs","repos_url":"https://api.github.com/users/MSOpenTech/repos","events_url":"https://api.github.com/users/MSOpenTech/events{/privacy}","received_events_url":"https://api.github.com/users/MSOpenTech/received_events","type":"Organization","site_admin":false},"repo":{"id":18086900,"name":"cordova-windows","full_name":"MSOpenTech/cordova-windows","owner":{"login":"MSOpenTech","id":1638184,"avatar_url":"https://avatars.githubusercontent.com/u/1638184?v=3","gravatar_id":"","url":"https://api.github.com/users/MSOpenTech","html_url":"https://github.com/MSOpenTech","followers_url":"https://api.github.com/users/MSOpenTech/followers","following_url":"https://api.github.com/users/MSOpenTech/following{/other_user}","gists_url":"https://api.github.com/users/MSOpenTech/gists{/gist_id}","starred_url":"https://api.github.com/users/MSOpenTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSOpenTech/subscriptions","organizations_url":"https://api.github.com/users/MSOpenTech/orgs","repos_url":"https://api.github.com/users/MSOpenTech/repos","events_url":"https://api.github.com/users/MSOpenTech/events{/privacy}","received_events_url":"https://api.github.com/users/MSOpenTech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MSOpenTech/cordova-windows","description":"Mirror of Apache Cordova Windows","fork":true,"url":"https://api.github.com/repos/MSOpenTech/cordova-windows","forks_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/forks","keys_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/teams","hooks_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/hooks","issue_events_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/issues/events{/number}","events_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/events","assignees_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/assignees{/user}","branches_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/branches{/branch}","tags_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/tags","blobs_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/git/refs{/sha}","trees_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/statuses/{sha}","languages_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/languages","stargazers_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/stargazers","contributors_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/contributors","subscribers_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/subscribers","subscription_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/subscription","commits_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/commits{/sha}","git_commits_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/git/commits{/sha}","comments_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/comments{/number}","issue_comment_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/issues/comments{/number}","contents_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/contents/{+path}","compare_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/merges","archive_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/downloads","issues_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/issues{/number}","pulls_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/pulls{/number}","milestones_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/milestones{/number}","notifications_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/labels{/name}","releases_url":"https://api.github.com/repos/MSOpenTech/cordova-windows/releases{/id}","created_at":"2014-03-25T02:52:48Z","updated_at":"2015-08-02T07:54:10Z","pushed_at":"2015-08-06T09:45:15Z","git_url":"git://github.com/MSOpenTech/cordova-windows.git","ssh_url":"git@github.com:MSOpenTech/cordova-windows.git","clone_url":"https://github.com/MSOpenTech/cordova-windows.git","svn_url":"https://github.com/MSOpenTech/cordova-windows","homepage":null,"size":35941,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"4b0e766fe291e6d469c836371a437f4f42208fa0","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":6898394,"name":"cordova-windows","full_name":"apache/cordova-windows","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/cordova-windows","description":"Mirror of Apache Cordova Windows","fork":false,"url":"https://api.github.com/repos/apache/cordova-windows","forks_url":"https://api.github.com/repos/apache/cordova-windows/forks","keys_url":"https://api.github.com/repos/apache/cordova-windows/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/cordova-windows/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/cordova-windows/teams","hooks_url":"https://api.github.com/repos/apache/cordova-windows/hooks","issue_events_url":"https://api.github.com/repos/apache/cordova-windows/issues/events{/number}","events_url":"https://api.github.com/repos/apache/cordova-windows/events","assignees_url":"https://api.github.com/repos/apache/cordova-windows/assignees{/user}","branches_url":"https://api.github.com/repos/apache/cordova-windows/branches{/branch}","tags_url":"https://api.github.com/repos/apache/cordova-windows/tags","blobs_url":"https://api.github.com/repos/apache/cordova-windows/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/cordova-windows/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/cordova-windows/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/cordova-windows/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/cordova-windows/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/cordova-windows/languages","stargazers_url":"https://api.github.com/repos/apache/cordova-windows/stargazers","contributors_url":"https://api.github.com/repos/apache/cordova-windows/contributors","subscribers_url":"https://api.github.com/repos/apache/cordova-windows/subscribers","subscription_url":"https://api.github.com/repos/apache/cordova-windows/subscription","commits_url":"https://api.github.com/repos/apache/cordova-windows/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/cordova-windows/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/cordova-windows/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/cordova-windows/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/cordova-windows/contents/{+path}","compare_url":"https://api.github.com/repos/apache/cordova-windows/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/cordova-windows/merges","archive_url":"https://api.github.com/repos/apache/cordova-windows/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/cordova-windows/downloads","issues_url":"https://api.github.com/repos/apache/cordova-windows/issues{/number}","pulls_url":"https://api.github.com/repos/apache/cordova-windows/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/cordova-windows/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/cordova-windows/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/cordova-windows/labels{/name}","releases_url":"https://api.github.com/repos/apache/cordova-windows/releases{/id}","created_at":"2012-11-28T08:00:28Z","updated_at":"2015-08-06T06:37:14Z","pushed_at":"2015-08-06T09:45:16Z","git_url":"git://github.com/apache/cordova-windows.git","ssh_url":"git@github.com:apache/cordova-windows.git","clone_url":"https://github.com/apache/cordova-windows.git","svn_url":"https://github.com/apache/cordova-windows","homepage":null,"size":36709,"stargazers_count":89,"watchers_count":89,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":98,"mirror_url":"git://git.apache.org/cordova-windows.git","open_issues_count":1,"forks":98,"open_issues":1,"watchers":89,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/cordova-windows/pulls/107"},"html":{"href":"https://github.com/apache/cordova-windows/pull/107"},"issue":{"href":"https://api.github.com/repos/apache/cordova-windows/issues/107"},"comments":{"href":"https://api.github.com/repos/apache/cordova-windows/issues/107/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/cordova-windows/pulls/107/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/cordova-windows/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/cordova-windows/pulls/107/commits"},"statuses":{"href":"https://api.github.com/repos/apache/cordova-windows/statuses/447f5036b708b3eba2165b29e81e19673503150c"}}}}