From issues-return-47045-apmail-cordova-issues-archive=cordova.apache.org@cordova.apache.org Wed Aug 5 17:27:05 2015 Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0700F18419 for ; Wed, 5 Aug 2015 17:27:05 +0000 (UTC) Received: (qmail 94852 invoked by uid 500); 5 Aug 2015 17:27:04 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 94822 invoked by uid 500); 5 Aug 2015 17:27:04 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 94807 invoked by uid 99); 5 Aug 2015 17:27:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Aug 2015 17:27:04 +0000 Date: Wed, 5 Aug 2015 17:27:04 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-8936) Surface platform-specific logs in buildbot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-8936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14658547#comment-14658547 ] ASF GitHub Bot commented on CB-8936: ------------------------------------ Github user alsorokin commented on a diff in the pull request: https://github.com/apache/cordova-windows/pull/107#discussion_r36328641 --- Diff: template/cordova/lib/log.js --- @@ -0,0 +1,226 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +var path = require('path'), + et = require('elementtree'), + Q = require('q'), + cp = require('child_process'), + shelljs = require('shelljs'); + +var appTracingLogInitialState = null, + adminLogInitialState = null; + +/* + * Gets windows AppHost/ApplicationTracing and AppHost/Admin logs + * and prints them to console + */ +module.exports.run = function() { + getLogState('Microsoft-Windows-AppHost/ApplicationTracing').then(function (state) { + appTracingLogInitialState = state; + return getLogState('Microsoft-Windows-AppHost/Admin'); + }).then(function(state) { + adminLogInitialState = state; + return enableLogging('Microsoft-Windows-AppHost/Admin'); + }).then(function () { + return enableLogging('Microsoft-Windows-AppHost/ApplicationTracing'); + }).then(function () { + console.log('Logging enabled, now printing logs. To stop, please press Ctrl+C once.'); + startLogging('Microsoft-Windows-AppHost/Admin'); + startLogging('Microsoft-Windows-AppHost/ApplicationTracing'); + }).catch(function (error) { + console.error(error); + }); + + // Disable logs before exiting + process.on('exit', function () { + if ((appTracingLogInitialState !== null) && !appTracingLogInitialState) { + disableLogging('Microsoft-Windows-AppHost/ApplicationTracing'); + } + if ((adminLogInitialState !== null) && !adminLogInitialState) { + disableLogging('Microsoft-Windows-AppHost/Admin'); + } + }); + + // Catch Ctrl+C event and exit gracefully + process.on('SIGINT', function () { + process.exit(2); + }); + + // Catch uncaught exceptions, print trace, then exit gracefully + process.on('uncaughtException', function(e) { + console.log(e.stack); + process.exit(99); + }); +}; + +function startLogging(channel) { + var startTime = new Date().toISOString(); + setInterval(function() { + var command = 'wevtutil qe ' + channel + ' /q:"*[System [(TimeCreated [@SystemTime>\'' + startTime + '\'])]]" /e:root'; + cp.exec(command, function (error, stdout, stderr) { + if (error) { + throw new Error('Failed to run wevtutil command. ' + error); + } else { + parseEvents(stdout).forEach(function (evt) { + startTime = evt.timeCreated; + console.log(stringifyEvent(evt)); + }); + } + }); + }, 1000); +} + +module.exports.help = function() { + console.log('Usage: ' + path.join('cordova', 'log')); --- End diff -- Fixed > Surface platform-specific logs in buildbot > ------------------------------------------ > > Key: CB-8936 > URL: https://issues.apache.org/jira/browse/CB-8936 > Project: Apache Cordova > Issue Type: Task > Components: Medic > Reporter: Alexander Sorokin > Assignee: Alexander Sorokin > > Platform specific logs (e.g. logcat for android, stderr.log and stdin.log for iOS etc.) should be gathered and displayed in buildbot. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org