Skip to content

Commit

Permalink
Print version of the product in log (#2535)
Browse files Browse the repository at this point in the history
  • Loading branch information
nohwnd authored Aug 25, 2020
1 parent f5e870b commit c1a6782
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions TestPlatform.sln
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ Global
{9EFCEFB5-253E-4DE2-8A70-821D7B8189DF} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6}
{3A8080FB-9C93-45B9-8EB5-828DDC31FDF0} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6}
{BFF7714C-E5A3-4EEB-B04B-5FA47F29AD03} = {020E15EA-731F-4667-95AF-226671E0C3AE}
{E344E0A2-7715-4C7F-BAF7-D64EA94CB19B} = {EE49F5DC-5835-4AE3-B3BA-8BDE0AD56330}
{DD9382B5-5EC4-4B3D-BEB7-95423731AE29} = {46250E12-4CF1-4051-B4A7-80C8C06E0068}
{156F8811-28BB-4EC7-87D9-434F10FB7DBE} = {46250E12-4CF1-4051-B4A7-80C8C06E0068}
{A5B167ED-873A-4762-9326-5F43B8D3AFF6} = {595BE9C1-E10F-4E50-938A-E6C248D3F950}
Expand Down
12 changes: 11 additions & 1 deletion src/datacollector/DataCollectorMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.DataCollector
using System;
using System.Diagnostics;
using System.Globalization;

using System.Reflection;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection.Interfaces;
Expand Down Expand Up @@ -79,6 +79,7 @@ public void Run(string[] args)
// Initialize trace.
EqtTrace.InitializeTrace(logFile, traceLevel);


// Log warning in case tracelevel passed in arg is invalid
if (!isTraceLevelArgValid)
{
Expand All @@ -90,6 +91,15 @@ public void Run(string[] args)
EqtTrace.DoNotInitailize = true;
}

if (EqtTrace.IsVerboseEnabled)
{
var version = typeof(DataCollectorMain)
.GetTypeInfo()
.Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
EqtTrace.Verbose($"Version: { version }");
}

SetCultureSpecifiedByUser();

EqtTrace.Info("DataCollectorMain.Run: Starting data collector run with args: {0}", string.Join(",", args));
Expand Down
12 changes: 11 additions & 1 deletion src/testhost.x86/DefaultEngineInvoker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Microsoft.VisualStudio.TestPlatform.TestHost
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestPlatform.Common;
Expand Down Expand Up @@ -73,6 +74,15 @@ public void Invoke(IDictionary<string, string> argsDictionary)
{
DefaultEngineInvoker.InitializeEqtTrace(argsDictionary);

if (EqtTrace.IsVerboseEnabled)
{
var version = typeof(DefaultEngineInvoker)
.GetTypeInfo()
.Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
EqtTrace.Verbose($"Version: { version }");
}

if (EqtTrace.IsInfoEnabled)
{
EqtTrace.Info("DefaultEngineInvoker.Invoke: Testhost process started with args :{0}",
Expand Down Expand Up @@ -142,7 +152,7 @@ private static RequestData GetRequestData(IDictionary<string, string> argsDictio
{
MetricsCollection =
telemetryOptedIn
? (IMetricsCollection) new MetricsCollection()
? (IMetricsCollection)new MetricsCollection()
: new NoOpMetricsCollection(),
IsTelemetryOptedIn = telemetryOptedIn
};
Expand Down
5 changes: 5 additions & 0 deletions src/vstest.console/Processors/EnableDiagArgumentProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Processors
using System.Globalization;
using System.IO;
using System.Linq;
using Microsoft.VisualStudio.TestPlatform.CommandLine.Internal;
using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.Utilities;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.Utilities;
Expand Down Expand Up @@ -153,6 +154,10 @@ public void Initialize(string argument)

// Initialize diag logging.
InitializeDiagLogging(diagFilePath, diagParameters);

// Write version to the log here, because that is the
// first place where we know if we log or not.
EqtTrace.Verbose($"Version: {Product.Version}");
}

/// <summary>
Expand Down

0 comments on commit c1a6782

Please sign in to comment.