Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable all output in CI environment #224

Closed
svenjacobs opened this issue Aug 3, 2021 · 7 comments
Closed

Disable all output in CI environment #224

svenjacobs opened this issue Aug 3, 2021 · 7 comments
Assignees
Labels

Comments

@svenjacobs
Copy link

It would be nice to provide a configuration option to disable any console output by the plugin, like if the plugin was not applied to the project at all. The reason for my request is that in a CI environment, all these outputs slow down the builds :(

Of course I could conditionally add the plugin to the project based on certain system properties or so, however this would mean adjusting the project configuration at several places (e.g. where the plugin is applied and where it is configured). It would be much nicer if I just can do a

testlogger {
    silent = true
}
@radarsh
Copy link
Owner

radarsh commented Aug 3, 2021

You can already do that today by using the following configuration:

testlogger {
    logLevel 'quiet'
}

https://github.com/radarsh/gradle-test-logger-plugin#change-log-level

@radarsh radarsh closed this as completed Aug 3, 2021
@svenjacobs
Copy link
Author

I tried logLevel = LogLevel.QUIET (Kotlin DSL) and I still see all the output :(

@radarsh
Copy link
Owner

radarsh commented Aug 3, 2021

Oh, maybe I haven't released it. I'll reopen it for now and look at it later.

@radarsh radarsh reopened this Aug 3, 2021
@svenjacobs
Copy link
Author

Well, the property is already there but it seems to have no effect as you describe. Thanks for looking into this.

@radarsh
Copy link
Owner

radarsh commented Aug 3, 2021

OK you can still do this using the current version. You need to set the log level for testlogger to be lower than the log level at which Gradle runs. The below are the Gradle log levels:

DEBUG
INFO
LIFECYCLE
WARN
QUIET
ERROR

By default Gradle uses LIFECYCLE. The plugin also logs at this level. So if you don't want any logs to appear you have two options:

  1. Run Gradle using a level higher than LIFECYCLE on CI. This can be done by specifying either --warn or --quiet on the command line.
  2. Run Gradle as normal but change testlogger configuration to use logLevel 'info' or logLevel 'debug'. You can also do this on the command line by passing a system property testLogger.logLevel=info or testlogger.logLevel=debug.

Hope that helps.

@radarsh radarsh closed this as completed Aug 3, 2021
@svenjacobs
Copy link
Author

Thanks, that works!

FYI, there is a typo in your answer above: testLogger.loglevel should be testlogger.logLevel (no capital L in testlogger). So the correct command would be for example

./gradlew test -Dtestlogger.logLevel=info

@radarsh
Copy link
Owner

radarsh commented Aug 4, 2021

Thanks. Fixed the typo :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants