Skip to content

Log level is not set to Warning #3187

@HakamFostok

Description

@HakamFostok

I am using TUnit.Playwright 0.61.22.
I am also using Microsoft.AspNetCore.Mvc.Testing to start the Test server

The problem is that the test is generating a tremendous amount of logging, all the way down to the INF level
That makes finding the ERR level (especially on the CI/CD) a very, very hard task.

I would like to get only Warning and above log levels to focus on the problem

I have tried this

webHostBuilder.ConfigureTestServices(services =>
{
    builder.ConfigureLogging(logging => logging.SetMinimumLevel(LogLevel.Warning));
});

And also, I tried this command

dotnet run -c Release --report-trx --diagnostic-verbosity 'Warning'

But nothing worked, still I am getting a huge amount of logs, which really clutter the important information that I need

The docs I consulted are
https://tunit.dev/docs/customization-extensibility/logging/
https://learn.microsoft.com/en-us/dotnet/core/testing/microsoft-testing-platform-architecture-services#the-iloggerfactory-service

But I did not find anything useful in them

Here is a sample of the log I am getting

 [testcontainers.org 00:00:00.72] Docker container 9774180d2401 created
[testcontainers.org 00:00:00.87] Start Docker container 9774180d2401
[testcontainers.org 00:00:01.43] Wait for Docker container 9774180d2401 to complete readiness checks
[testcontainers.org 00:00:01.44] Docker container 9774180d2401 ready
[testcontainers.org 00:00:01.68] Docker container 0dca1c502f71 created
[testcontainers.org 00:00:01.73] Start Docker container 0dca1c502f71
[testcontainers.org 00:00:02.15] Wait for Docker container 0dca1c502f71 to complete readiness checks
[testcontainers.org 00:00:02.18] Execute "pg_isready --host localhost --dbname troytestdb --username postgres" at Docker container 0dca1c502f71
[testcontainers.org 00:00:03.47] Execute "pg_isready --host localhost --dbname troytestdb --username postgres" at Docker container 0dca1c502f71
[testcontainers.org 00:00:04.73] Execute "pg_isready --host localhost --dbname troytestdb --username postgres" at Docker container 0dca1c502f71
[testcontainers.org 00:00:04.89] Docker container 0dca1c502f71 ready
[14:06:14 INF] ┊ Initializing UI Database
[14:06:14 INF] ┊ Initializing UI Database
[14:06:15 INF] ┊ Saving healthchecks configuration to database
[14:06:15 INF] ┊ Saving healthchecks configuration to database
[14:06:15 INF] ┊ Saved 1 entities to in-memory store.
[14:06:15 INF] ┊ Saved 1 entities to in-memory store.

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