Skip to content

Question: Logger output includes very limited information #27

@JamesSkemp

Description

@JamesSkemp

I'm using the current version of the msbuild package in my project. Running npm task via Visual Studio 2019 (build tools version 16.0).

I have the following defined in my gulpfile.js, with the logger code based upon this project's main README:

/**
 * Publish the main solution using msbuild, for a particular configuration.
 * @param {any} callback Gulp task callback.
 * @param {any} siteName Website name/configuration.
 */
function msBuildPublish(callback, siteName) {
	var build = new msbuild(callback);
	build.sourcePath = config.solutionName + '.sln';
	build.logger = function (results) {
		fs.appendFile('./_build-logger-' + siteName + '.txt', '\n' + results, function (err) { });
	};
	build.on('status', function (err, results) {
		fs.appendFile('./_build-' + siteName + '.txt', '\nRESULTS: ' + results, function (err) { });
	});
	build.on('error', function (err, results) {
		fs.appendFile('./_build-' + siteName + '.txt', '\nERROR: ' + results, function (err) { });
	});
	build.on('done', function (err, results) {
		fs.appendFile('./_build-' + siteName + '.txt', '\nDONE: ' + results, function (err) { });
	});
	var overrideParams = [];
	overrideParams.push('/p:Configuration=' + siteName);
	overrideParams.push('/t:Build;GatherAllFilesToPublish');
	overrideParams.push('/consoleloggerparameters:Summary');
	overrideParams.push('/verbosity:minimal');
	// Have each configuration publish to a unique location.
	overrideParams.push('/p:publishUrl=' + config.buildPublishLocation + '\\' + siteName);

	build.config('overrideParams', overrideParams);
	build.config('version', config.buildToolsVersion);
	build.build();
}

Unfortunately this results in log files that look like the following:

_build-siteName.txt:


RESULTS: �[36m  build starting�[39m
DONE: �[42m�[37m
 finished - (0) errors�[39m�[49m

_build-logger-siteName.txt:


�[36m  build starting�[39m
�[42m�[37m
 finished - (0) errors�[39m�[49m

- - - - - - - - - - - - - - - -
build done

What I'm hoping to get is something closer to the output I'm seeing in Visual Studio 2019's Task Runner Explorer console, a trimmed example of which is below:

[13:34:37] Using gulpfile D:\git\Xxx-modules\Gulpfile.js
[13:34:37] Starting 'Publish-Website-bus-dev'...
Microsoft (R) Build Engine version 16.3.2+e481bbf88 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
  Xxx.Foundation.Serialization -> D:\git\Xxx-modules\src\Foundation\Serialization\code\bin\Xxx.Foundation.Serialization.dll
  Copying all files to temporary location below for package/publish:
  obj\Debug\Package\PackageTmp.
  Xxx.Foundation.XxxExtensions -> D:\git\Xxx-modules\src\Foundation\XxxExtensions\code\bin\Xxx.Foundation.XxxExtensions.dll
  Copying all files to temporary location below for package/publish:
  obj\Debug\Package\PackageTmp.
  Xxx.Foundation.Theming -> D:\git\Xxx-modules\src\Foundation\Theming\code\bin\Xxx.Foundation.Theming.dll
  Copying all files to temporary location below for package/publish:
  obj\Debug\Package\PackageTmp.
[...]
  Xxx.Feature.LrmIntegration -> D:\git\Xxx-modules\src\Feature\LrmIntegration\code\bin\Xxx.Feature.LrmIntegration.dll
  Copying all files to temporary location below for package/publish:
  obj\Debug\Package\PackageTmp.
  Auto ConnectionString Transformed obj\Debug\Package\PackageTmp\Views\Web.config into obj\Debug\CSAutoParameterize\transformed\Views\Web.config.
  Xxx.Project.DesignSystemWebsite -> D:\git\Xxx-modules\src\Project\DesignSystemWebsite\code\bin\Xxx.Project.DesignSystemWebsite.dll
  Copying all files to temporary location below for package/publish:
  obj\Debug\Package\PackageTmp.
  Xxx.Feature.SchoolDirectory -> D:\git\Xxx-modules\src\Feature\SchoolDirectory\code\bin\Xxx.Feature.SchoolDirectory.dll
  Copying all files to temporary location below for package/publish:
  obj\Debug\Package\PackageTmp.
  Xxx.Feature.EventCustomization -> D:\git\Xxx-modules\src\Feature\EventCustomization\code\bin\Xxx.Feature.EventCustomization.dll
  Copying all files to temporary location below for package/publish:
  obj\Debug\Package\PackageTmp.
Process terminated with code 0.
  Xxx.Feature.StudentData -> D:\git\Xxx-modules\src\Feature\StudentData\code\bin\Xxx.Feature.StudentData.dll
  Copying all files to temporary location below for package/publish:
  obj\Debug\Package\PackageTmp.
  The solution has completed the Build target.
  The XxxWebsite project has completed the GatherAllFilesToPublish target.
Build succeeded.
    0 Warning(s)
    0 Error(s)
Time Elapsed 00:00:07.97
[13:34:46] Finished 'Publish-Website-bus-dev' after 8.14 s

I've tried disabling the consoleloggerparameters and verbosity switches in the code, but while my VS output includes more information the logged text file contains the exact same information.

Am I missing something in my logging setup that would output more information to the text file I define?

Thanks. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions