question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow customise test log output location

See original GitHub issue
  • This issue is blocking
  • This issue is causing unreasonable pain

The solution I’m currently working consists of hundreds of projects (many of which a test projects). As a result the ./artifacts/logs folder gets filled with many *.log files (example). It makes it difficult to see other logs produced during the build. The paths are configured here: https://github.com/dotnet/arcade/blob/0978c75667efa5248017f7babab1ff966ab7e622/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets#L40-L68

I’m specifically interested in ResultsStdOutPath, and it doesn’t look like the destination path can be easily customised (short of changing ArtifactsLogDir variable).

May we entertain the following tweak?

    <PropertyGroup>
      <_TestArchitecture>%(_TestArchitectureItems.Identity)</_TestArchitecture>
      <_ResultFileNameNoExt>$(MSBuildProjectName)_$(TargetFramework)_$(_TestArchitecture)</_ResultFileNameNoExt>

+     <TestResultsLogDir Condition=" '$(TestResultsLogDir)' == '' ">$(ArtifactsLogDir)</TestResultsLogDir>
    </PropertyGroup>

    <ItemGroup>
      <TestToRun Include="$(TargetPath)">
        <TargetFramework>$(TargetFramework)</TargetFramework>
        <TargetFrameworkIdentifier>$(TargetFrameworkIdentifier)</TargetFrameworkIdentifier>
        <TargetFrameworkVersion>$(TargetFrameworkVersion)</TargetFrameworkVersion>
        <TestRuntime>$(TestRuntime)</TestRuntime>
        <TestTimeout>$(TestTimeout)</TestTimeout>
        <Architecture>$(_TestArchitecture)</Architecture>
        <EnvironmentDisplay>$(TargetFramework)|$(_TestArchitecture)</EnvironmentDisplay>
        <ResultsFilePathWithoutExtension>$(_ResultFileNameNoExt)</ResultsFilePathWithoutExtension>
        <ResultsXmlPath>$(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).xml</ResultsXmlPath>
        <ResultsTrxPath>$(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).trx</ResultsTrxPath>
        <ResultsHtmlPath>$(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).html</ResultsHtmlPath>
-       <ResultsStdOutPath>$(ArtifactsLogDir)$(_ResultFileNameNoExt).log</ResultsStdOutPath>
+       <ResultsStdOutPath>$(TestResultsLogDir)$(_ResultFileNameNoExt).log</ResultsStdOutPath>
        <TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments)</TestRunnerAdditionalArguments>
      </TestToRun>
    </ItemGroup>
  </Target>

This way I can alter my solution’s config as this:

  <PropertyGroup>
    <TestResultsLogDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsLogDir)', 'TestLogs'))</TestResultsLogDir>
  </PropertyGroup>

…and have tests in a subfolder: image

Release Note Category

  • Feature changes/additions
  • Bug fixes
  • Internal Infrastructure Improvements

Release Note Description

Issue Analytics

  • State:closed
  • Created 7 months ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
RussKiecommented, Feb 21, 2023

Alright, after regenerating both tokens it seemed to work. Thank you for the suggestions.

1reaction
RussKiecommented, Feb 21, 2023

May be your local Azdo PAT expired. Try to regenerate it and put it back in darc-authenticate -(main/Documentation/Darc.md#authenticate)

I updated AzDO PAT, and still the same result…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Controlling output of Boost.Test source location format
This format doesn't allow my editor to recognize the output as a source location. Is there way to make Boost.Test output the source...
Read more >
How to view log output while tests are running in VS 2019 ...
run a test · select the test in Test Explorer in VS · Click the "Open additional output for this result" link.
Read more >
How to manage logging
Inside tests it is possible to change the log level for the captured log messages. This is supported by the caplog fixture:.
Read more >
Plugin Development: Managing Log Output | Terraform
You can use environment variables to turn on logging, filter log output, choose the log format, and specify the log output path.
Read more >
Explore test results | IntelliJ IDEA Documentation
The console on the right shows the output of the current test session. It allows you to see the detailed information on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found